LoadViewState override not firing in UserControl

Discussion in 'ASP .Net Building Controls' started by Umbaga, Dec 9, 2003.

  1. Umbaga

    Umbaga Guest

    We're trying to get an override void LoadViewState to fire in a user
    control that has been added dynamically to the page. The SaveViewState
    seems to be firing just fine as evidenced by the
    System.Diagnostics.Debug inserted into the overrides.

    In a nutshell, the page loads a control in response to a button click.
    The page then loads a Control that contains HTML to give the Final
    Control A border. Then this newly loaded control loads a control
    determined by the button clicked on the page.

    The page's LoadViewState override fires just fine. But once the first
    user control attempts to load the viewstate, it fails.

    Thanks
    Umbaga, Dec 9, 2003
    #1
    1. Advertising

  2. how do you load you usercontrol dynamically?

    --
    http://www.lostinet.com/
    Lostinet.Web Controls&Components help you to build better Asp.Net
    CustomerControl&UserControl&Application.
    ControlHelper&HelperElement for MessageBox&Dialog
    ComboBox,ComboCalendar,SmartIframe
    ---------------------------
    Remote Asp.Net Execution

    "Umbaga" <> ????
    news:...
    > We're trying to get an override void LoadViewState to fire in a user
    > control that has been added dynamically to the page. The SaveViewState
    > seems to be firing just fine as evidenced by the
    > System.Diagnostics.Debug inserted into the overrides.
    >
    > In a nutshell, the page loads a control in response to a button click.
    > The page then loads a Control that contains HTML to give the Final
    > Control A border. Then this newly loaded control loads a control
    > determined by the button clicked on the page.
    >
    > The page's LoadViewState override fires just fine. But once the first
    > user control attempts to load the viewstate, it fails.
    >
    > Thanks
    Lostinet.Web Support, Dec 10, 2003
    #2
    1. Advertising

  3. Umbaga

    Umbaga Guest

    There's a number of levels to this process. We're not that good at the
    technical jargon.

    The main page is Index.aspx
    In the code-behind Index.aspx.cs file the html elements are
    constructed and added to the page.

    A custom-control: ElementManager which extend INamingcontainer and
    System.Web.UI.WebControls.WebControl is also added to the Index page
    programatically.

    The ElementManager is being declared as a member of the class(inside
    the "public class Index" but outside of "private void Page_Load")

    In Page_Load the the HTML is built and added with "this.controls.add"
    and the ElementManager is added to an HtmlGenericControl("Form").

    Other Controls are added to the ElementManager in CreateChildControls,
    but the ElementManager is the first layer at which the override of
    LoadViewState does not function.

    Any suggestions will be most appreciated.
    This is the class for the Index

    public class Index : System.Web.UI.Page
    {
    private System.Web.UI.HtmlControls.HtmlGenericControl HTML;
    public System.Web.UI.HtmlControls.HtmlGenericControl HEAD;
    public System.Web.UI.HtmlControls.HtmlGenericControl TITLE;
    public System.Web.UI.HtmlControls.HtmlGenericControl BODY;
    private System.Web.UI.HtmlControls.HtmlForm FORM;
    public System.Web.UI.WebControls.OurControls.ElementManager
    ElementMGR;

    private void Page_Load(object sender, System.EventArgs e)
    {
    HTML = new HtmlGenericControl("HTML");
    this.Controls.Add(HTML);
    HEAD = new HtmlGenericControl("HEAD");
    HTML.Controls.Add(HEAD);
    TITLE = new HtmlGenericControl("TITLE");
    HEAD.Controls.Add(TITLE);
    BODY = new HtmlGenericControl("BODY");
    FORM = new HtmlForm();
    ElementMGR = new System.Web.UI.WebControls.OurControls.ElementManager();
    this.FORM.Controls.Add(ElementMGR);
    }
    }
    Umbaga, Dec 10, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William F. Robertson, Jr.

    LoadViewState not firing

    William F. Robertson, Jr., Apr 16, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    4,387
    William F. Robertson, Jr.
    Apr 16, 2004
  2. =?Utf-8?B?RGV2aW4gRmVuc3RlcmhlaW0=?=

    LoadViewState not firing when Control added with AddAt

    =?Utf-8?B?RGV2aW4gRmVuc3RlcmhlaW0=?=, Jul 18, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,487
    Jyoti Ballabh
    Nov 26, 2009
  3. J.
    Replies:
    0
    Views:
    1,865
  4. Bill Biddy

    LoadViewState not firing on PostBack

    Bill Biddy, Jan 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    210
    Bill Biddy
    Jan 20, 2004
  5. jsc

    Derived TreeNode LoadViewState not firing

    jsc, Jan 12, 2009, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    198
Loading...

Share This Page