Handling server side events before CreateChildControls

Discussion in 'ASP .Net Building Controls' started by Chris, Feb 22, 2008.

  1. Chris

    Chris Guest

    Is it possible to handle server side events before
    CreateChildControls?
    e.g. If you have a treeview control and the user clicks on an expand
    node what would happen would be CreateChildControls would be called
    first to recreate the treeview as is and then the event would be fired
    and you would need have to add new nodes to the current tree or
    recreate the whole tree again with the added nodes. What would be
    nicer would be if you knew before CreateChildControls that the user
    had click an expand node and could create the resulting tree in the
    first call to CreateChildControls.

    Thanks
    Chris
    Chris, Feb 22, 2008
    #1
    1. Advertising

  2. Chris

    Chris Guest

    On Feb 22, 10:01 am, Chris <> wrote:
    > Is it possible to handle server side events before
    > CreateChildControls?
    > e.g. If you have a treeview control and the user clicks on an expand
    > node what would happen would be CreateChildControls would be called
    > first to recreate the treeview as is and then the event would be fired
    > and you would need have to add new nodes to the current tree or
    > recreate the whole tree again with the added nodes. What would be
    > nicer would be if you knew before CreateChildControls that the user
    > had click an expand node and could create the resulting tree in the
    > first call to CreateChildControls.
    >
    > Thanks
    > Chris


    ok I seem to have 2 possible solutions.

    The first is just let the server side events occur after
    CreateChildControls(). The downside to this is that I will have to
    enforce CreateChildControls() to run a second time which means doing
    everything twice and will be slower but should at least work.

    The other solution seems to be to handle all the events client side
    and from there manually send a postback event back and set the
    argument to a string that contains all of the event information I need
    and parse that string (Me.Page.Request.Params("__EVENTARGUMENT")) at
    the beginning of CreateChildControls or maybe Init() and so handle it
    before i create any child controls.

    Does the second solution sound workable? Anyone done anything like
    this before?
    Chris, Feb 22, 2008
    #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. Lucas Tam
    Replies:
    1
    Views:
    737
    John Saunders
    Aug 17, 2003
  2. Arulraja
    Replies:
    3
    Views:
    1,374
    William F. Robertson, Jr.
    Oct 17, 2003
  3. Ferret
    Replies:
    3
    Views:
    5,177
    John Saunders
    Dec 3, 2004
  4. Paul
    Replies:
    0
    Views:
    493
  5. Mark Sisson

    CreateChildControls Event before Click Event

    Mark Sisson, Jul 17, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    369
    Victor Garcia Aprea [MVP]
    Jul 17, 2003
Loading...

Share This Page