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. Advertisements

  2. Chris

    Chris Guest

    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. 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.