Re: Reload user control?
- From: Mats Lycken <MatsL@xxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Dec 2005 19:00:32 +0100
Thanks for the tip Steven, I'll look into it!
Steven Cheng[MSFT] wrote:
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
| >>
|
.
- Follow-Ups:
- Re: Reload user control?
- From: Steven Cheng[MSFT]
- Re: Reload user control?
- References:
- Reload user control?
- From: Mats Lycken
- Re: Reload user control?
- From: Mats Lycken
- Re: Reload user control?
- From: Steven Cheng[MSFT]
- Reload user control?
- Prev by Date: RE: Can I use more than one style in a treeview control at the roo
- Next by Date: Re: Reload user control?
- Previous by thread: Re: Reload user control?
- Next by thread: Re: Reload user control?
- Index(es):
Relevant Pages
|