RegisterRequiresPostBack and child custom controls

Discussion in 'ASP .Net Web Controls' started by Cathead, Oct 1, 2003.

  1. Cathead

    Cathead Guest

    I have a composite custom control that creates other custom composite
    controls within CreateChildControls(). 2 questions:

    1) Must you explicitly call Page.RegisterRequiresPostBack for every control
    that is interested in postbacks?

    I assumed from the documentation that the ASP.NET page framework would call
    LoadPostData on every IPostBackDataHandler that was a part of the control
    tree. This was not happening for my custom controls until I registered them
    with Page.RegisterRequiresPostBack within the control's OnInit(). Is this
    expected behavior?

    2) Registering with Page.RegisterRequiresPostBack() caused my top-level
    custom control's LoadPostData to be fired, but not those of the child custom
    controls. Within my top-level control, do I have the responsibility to
    propogate the LoadPostData() to child controls? For example:

    public virtual bool LoadPostData(string postDataKey, NameValueCollection
    foreach(Control c in Controls) {
    c.LoadPostData(postDataKey, postCollection);

    Thanks in advance.

    Cathead, Oct 1, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.