Re: Reload user control?



Sorry, I'm still not sure what you mean

Elton Wang wrote:
What I mean is that each time you load usecontrol dynamically depending on condition, even from begining.

HTH

"Mats Lycken" <MatsL@xxxxxxxxxxxxxxxxx> wrote in message news:%23ZfjikkCGHA.1124@xxxxxxxxxxxxxxxxxxxxxxx

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

  • Reload user control?
    ... A problem arises when I in one webcontrol makes a change that should be picked up by another user control. ... In another I have an overview of the shopping cart. ... 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.Transferin 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. ...
    (microsoft.public.dotnet.framework.aspnet)
  • How to load different user control - Call made from control being replaced
    ... I need to replace a user control on a page with a different user control. ... here's the unique scenario I'm working with now: The main (parent) ... Now in the shoppingcart control a user clicked on ... the shopping cart control. ...
    (microsoft.public.dotnet.framework.aspnet)
  • User Control Not Updating
    ... Working on a shopping cart app. ... I've got a user control that appears on ...
    (microsoft.public.dotnet.framework.aspnet)
  • Help with best way to create a filtering record selector in a database application
    ... There is a datagrid on the left side that lists ... and then bind the datagrid to that DataView object. ... User Control, which I've called Navigator. ... ViewManager viewManager; ...
    (microsoft.public.dotnet.languages.csharp)
  • IPostBackDataHandler not working properly with DataGrid
    ... IPostBackDataHandler when it is placed inside a datagrid. ... I have created a user control containing 1 TextBox ... public class MyUserControl: System.Web.UI.UserControl, ... private void Page_Load ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)

Loading