Composite webcontrol and postback

Discussion in 'ASP .Net Building Controls' started by George Ionescu, Jul 5, 2004.

  1. Hello all,

    while trying to develop a composite webcontrol (which has, among other
    things two textboxes and no submit buttons) I've faced the following
    problem:

    how can I read webcontrol's texboxes values, how can it pass data posted
    from the client (the post is done with a command button on the page which
    hosts the control)

    I've looked into IPostBackDataHandler.LoadPostData, but it doesn't get
    fired.

    Any examples, if possible.

    Thank you.
    Regards,
    George Ionescu
     
    George Ionescu, Jul 5, 2004
    #1
    1. Advertising

  2. George Ionescu

    Teemu Keiski Guest

    Hi,

    if you create the child controls in overridden CreateChildControls and you
    implement INamingContainer in the composite control this stuff is already
    done for you (I mean postback data handling for textBoxes and so on)

    You can get the text values via Text property of the child TextBoxes. There
    shouldn't be any need to get to the middle of the postback data processing
    of TextBoxes as they are child controls and handle the processing
    independently. You shouldn't be interested in that but instead you just pick
    the values from the controls via relevant properties (or by say attaching
    event handlers, for example to TextChanged events of TextBoxes, to get
    informed when the value changes)

    But if you for a reason or another absolutely want to get to the postback
    data processing, you need to put Page.RegisterRequiresPostBack call on your
    composite control's OnPreRender method to make sure
    IPostBackDataHandler.LoadPostData is called for your composite control on
    postback (this way it will be called for your composite control even if it
    doesn't post anything itself e.g have something on form post collection)

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke



    "George Ionescu" <> wrote in message
    news:...
    > Hello all,
    >
    > while trying to develop a composite webcontrol (which has, among other
    > things two textboxes and no submit buttons) I've faced the following
    > problem:
    >
    > how can I read webcontrol's texboxes values, how can it pass data posted
    > from the client (the post is done with a command button on the page which
    > hosts the control)
    >
    > I've looked into IPostBackDataHandler.LoadPostData, but it doesn't get
    > fired.
    >
    > Any examples, if possible.
    >
    > Thank you.
    > Regards,
    > George Ionescu
    >
    >
    >
    >
     
    Teemu Keiski, Jul 5, 2004
    #2
    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. sleigh
    Replies:
    1
    Views:
    2,694
    sleigh
    Feb 12, 2004
  2. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    188
    Kasabaarde Sumta
    Dec 13, 2004
  3. Chad
    Replies:
    0
    Views:
    227
  4. George Ionescu

    Composite webcontrol and postback

    George Ionescu, Jul 5, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    111
    Robert Koritnik
    Jul 5, 2004
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    266
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page