How to force the child controls OnClick event before the parent controls CreateChildControls method

Discussion in 'ASP .Net' started by Arulraja, Oct 16, 2003.

  1. Arulraja

    Arulraja Guest

    Hello,

    I have created 2 custom server controls, The parent custom control
    contains multiple child custom controls. The Child control has a
    button on it.
    If I Click the button control, it calls the Parent controls
    CreateChildControls() method before calling the child control's button
    click event.

    Because of this behaviour, I am not getting the changes I made in the
    child controls button click event.

    I think I am doing something wrong with the event handling?

    Can somebody point to the right way of ahndling the child controls
    Events?

    Thanks
    Sam
     
    Arulraja, Oct 16, 2003
    #1
    1. Advertising

  2. The CreateChildControls method must be called before the child's event is
    "called", otherwise there will be no control to raise the event
    notification.

    Are you wanting to bubble the event up to the consumer?

    Are you just wanted to handle the event from the control only?

    bill



    "Arulraja" <> wrote in message
    news:...
    > Hello,
    >
    > I have created 2 custom server controls, The parent custom control
    > contains multiple child custom controls. The Child control has a
    > button on it.
    > If I Click the button control, it calls the Parent controls
    > CreateChildControls() method before calling the child control's button
    > click event.
    >
    > Because of this behaviour, I am not getting the changes I made in the
    > child controls button click event.
    >
    > I think I am doing something wrong with the event handling?
    >
    > Can somebody point to the right way of ahndling the child controls
    > Events?
    >
    > Thanks
    > Sam
     
    William F. Robertson, Jr., Oct 16, 2003
    #2
    1. Advertising

  3. Arulraja

    Arulraja Guest

    Hi Bill,

    Thanks for the response. Actually I want to handle the event from the
    control.
    During that process I validate the user entered values, after that I
    want to render the changes to the page.(That is calling the
    CreateChildControls method).

    But, right now the CreateChildControls method gets fired before the
    OnClick event so I am not able to force the CreateChildControls
    method after the onClick event.

    Is there anyway I can force the CreateChildControls method call after
    the onClick event.

    Thanks for your help. Really appreciate that.

    -Sam

    "William F. Robertson, Jr." <> wrote in message news:<>...
    > The CreateChildControls method must be called before the child's event is
    > "called", otherwise there will be no control to raise the event
    > notification.
    >
    > Are you wanting to bubble the event up to the consumer?
    >
    > Are you just wanted to handle the event from the control only?
    >
    > bill
    >
    >
    >
    > "Arulraja" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I have created 2 custom server controls, The parent custom control
    > > contains multiple child custom controls. The Child control has a
    > > button on it.
    > > If I Click the button control, it calls the Parent controls
    > > CreateChildControls() method before calling the child control's button
    > > click event.
    > >
    > > Because of this behaviour, I am not getting the changes I made in the
    > > child controls button click event.
    > >
    > > I think I am doing something wrong with the event handling?
    > >
    > > Can somebody point to the right way of ahndling the child controls
    > > Events?
    > >
    > > Thanks
    > > Sam
     
    Arulraja, Oct 17, 2003
    #3
  4. I might not be speaking in complete truths here, but if you call
    Controls.Clear, and then set the ChildControlsCreated to false.

    But from what I understand you want to do, you should just call the
    CreateChildControls() explicitly from the event and the controls will be
    recreated.

    On the second call the CreateChildControls, make sure you call
    Controls.Clear().

    bill


    "Arulraja" <> wrote in message
    news:...
    > Hi Bill,
    >
    > Thanks for the response. Actually I want to handle the event from the
    > control.
    > During that process I validate the user entered values, after that I
    > want to render the changes to the page.(That is calling the
    > CreateChildControls method).
    >
    > But, right now the CreateChildControls method gets fired before the
    > OnClick event so I am not able to force the CreateChildControls
    > method after the onClick event.
    >
    > Is there anyway I can force the CreateChildControls method call after
    > the onClick event.
    >
    > Thanks for your help. Really appreciate that.
    >
    > -Sam
    >
    > "William F. Robertson, Jr." <> wrote in message

    news:<>...
    > > The CreateChildControls method must be called before the child's event

    is
    > > "called", otherwise there will be no control to raise the event
    > > notification.
    > >
    > > Are you wanting to bubble the event up to the consumer?
    > >
    > > Are you just wanted to handle the event from the control only?
    > >
    > > bill
    > >
    > >
    > >
    > > "Arulraja" <> wrote in message
    > > news:...
    > > > Hello,
    > > >
    > > > I have created 2 custom server controls, The parent custom control
    > > > contains multiple child custom controls. The Child control has a
    > > > button on it.
    > > > If I Click the button control, it calls the Parent controls
    > > > CreateChildControls() method before calling the child control's button
    > > > click event.
    > > >
    > > > Because of this behaviour, I am not getting the changes I made in the
    > > > child controls button click event.
    > > >
    > > > I think I am doing something wrong with the event handling?
    > > >
    > > > Can somebody point to the right way of ahndling the child controls
    > > > Events?
    > > >
    > > > Thanks
    > > > Sam
     
    William F. Robertson, Jr., Oct 17, 2003
    #4
    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. Mark Sisson

    CreateChildControls Event before Click Event

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

    CreateChildControls Event before Click Event

    Mark Sisson, Jul 17, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    201
    Victor Garcia Aprea [MVP]
    Jul 17, 2003
  3. createchildcontrols fires before click event

    , Jun 26, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    202
    Tom John
    Jul 4, 2007
  4. Noel Dolan
    Replies:
    0
    Views:
    242
    Noel Dolan
    Jul 18, 2004
  5. Bitswapper
    Replies:
    5
    Views:
    153
    Prasad, Ramit
    Aug 27, 2013
Loading...

Share This Page