1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Losing updates made to a user control

Discussion in 'C#' started by seatllesteve, Jun 27, 2010.

  1. seatllesteve

    seatllesteve New Member

    Joined:
    Jun 27, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    0
    I have a user control that I am explicitely calling from an aspx page. In page_load of hte aspx page I have the following, myControl = (DynamicTable)Page.LoadControl("../inc/DynamicTable.ascx"); Then in my code where I want it to execute the control, I have this pnlESDDEnrolled.Controls.Add(myControl); where pnlESDDEnrolled is the panel I am loading it into for display.

    So, I execute the aspx page, it links off to the user control, populates the control, returns back to the aspx page and the page dispalys with the user control in the middle of it. All is well.

    The problem comes in when updates are made on the user control. Keep in mind, that other data is updated on the page as well, and the update button resides on the page, not the control. Anyway, when the update button is pushed, the button_click event is fired on the page, but the updates that I made on the user control are lost. Since the page loaded the user control and then the usercontrol executed the page unload method, the page has no knowledge of the user control anymore. Thus, when the update button on the page is pushed, I guess I am not really sure what happens with the updated data on the user control. All's I know, it is lost. I have been working on this for a huge amount of time, any help would be much appreciated Thx.
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    This Should not be under Introduction forum and so moved to C# Programming
     

Share This Page