Re: Reload user control?



Hi Mats,

IMO, you can consider customize your ascx usercontrol to expose some public
method which can be called by external users to update its UI
view(controls....). I think the shopping cart's change will cause a
postback, yes? If so, the postback event will be the proper time you find
the userControl's reference in the Page and then call that Usercontrol's
exposed public method( which will update the usercontrol's UI/Control
properties.....)....

Also, if you've ever had a look at the WSS or ASP.NET's web part controls
and its Connections part framework, this is just something like that, when
one control's status changes (cause postback), in the postback event, the
page will find another control that should react to the changes , and call
the corresponding method.......

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Date: Mon, 26 Dec 2005 19:22:48 +0100
| From: Mats Lycken <MatsL@xxxxxxxxxxxxxxxxx>
| User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: Reload user control?
| References: <OuNddYjCGHA.2908@xxxxxxxxxxxxxxxxxxxx>
<2F1D08BB-4EC5-479C-8026-613D83F1DA2B@xxxxxxxxxxxxx>
| In-Reply-To: <2F1D08BB-4EC5-479C-8026-613D83F1DA2B@xxxxxxxxxxxxx>
| Content-Type: text/plain; charset=UTF-8; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <#ZfjikkCGHA.1124@xxxxxxxxxxxxxxxxxxxx>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 1-1-3-42a.vs.vs.bostream.se 82.182.18.143
| Lines: 1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:367079
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
| thanks for the reply.
|
| The thing is that the other user control already has been added when the
| other one has parsed its postback...
| I use LoadControl() to load the usercontrols.
|
| Elton W wrote:
| > You can dynamally load usercontrol by
| >
| > UserControl userControl = this.LoadControl("virtualPath");
| >
| > And put a PlaceHolder to hold the userControl
| >
| > PlaceHolder.Controls.Add(userControl);
| >
| > HTH
| >
| > Elton Wang
| >
| >
| > "Mats Lycken" wrote:
| >
| >
| >>Hi,
| >>I'm working on a webproject where I have several different user
controls
| >>loaded on a WebForm.
| >>A problem arises when I in one webcontrol makes a change that should be
| >>picked up by another user control.
| >>For example a webshop. I have a datagrid of products in the shopping
| >>cart in one user control. In another I have an overview of the shopping
| >>cart (lists the products and a shows an order total).
| >>When I remove a product from my datagrid I want the overview to reflect
| >>the changes. The only solution I could think of was to do a
| >>Server.Transfer() in the postback to "reload" the page, but it sounds
to
| >>me like a complete waste of resources to load the page twice for a
| >>single postback.
| >>
| >>Does anyone have any tips on how I could do it differently?
| >>
| >>My shopping cart overview does not have an if(!IsPostBack) clause.
| >>
| >>Thanks in advance
| >>/Mats
| >>
|

.



Relevant Pages

  • Re: Reload user control?
    ... you can consider customize your ascx usercontrol to expose some public method which can be called by external users to update its UI view. ... the postback event will be the proper time you find the userControl's reference in the Page and then call that Usercontrol's exposed public method(which will update the usercontrol's UI/Control ... | The thing is that the other user control already has been added when the | other one has parsed its postback... ... I have a datagrid of products in the shopping |>>cart in one user control. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: how to unload the web user control
    ... You can check it in the page_load event of the usercontrol, ... Response.Write("This is a PostBack... ... I am loading the user control every time the parent ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: how to unload the web user control
    ... How can I detect the postback ... I am loading the user control every time the parent page ... > When ever you are loading the usercontrol dynalically, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to handle Dynamic Controls within User Controls
    ... "delete" button, so on a postback, I wouldn't want it to appear again. ... >> I'm creating a usercontrol, and within this usercontrol, I'm dynamically ... I can't seem to be able to get the handlers to work ... >> the user control, to determine which control has been clicked, and what ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Raising events from constituent controls
    ... and you place the infragisitics grid on a usercontrol called ... private sub infragisticsGrid_GridFilled handles infragistics.filled ... now you need to declare and raise an event in your usercontrol like this ... >> raise both standard and custom events from the user control so the form ...
    (microsoft.public.dotnet.languages.vb)