Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to force the child controls OnClick event before the parent controls CreateChildControls method?

Reply
Thread Tools

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

 
 
Arulraja
Guest
Posts: n/a
 
      10-16-2003
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
 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      10-16-2003
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: om...
> 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



 
Reply With Quote
 
 
 
 
Arulraja
Guest
Posts: n/a
 
      10-17-2003
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: om...
> > 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

 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      10-17-2003
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: om...
> 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: om...
> > > 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Nike air force one, air force 1, air force one low cut, air force one salewholeta@163.com Digital Photography 3 12-31-2008 04:29 PM
Pass from parent to child, then update parent with child value... Noel Dolan Javascript 0 07-18-2004 05:52 PM
CreateChildControls Event before Click Event Mark Sisson ASP .Net Building Controls 1 07-17-2003 03:46 AM
CreateChildControls Event before Click Event Mark Sisson ASP .Net Web Controls 1 07-17-2003 03:46 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57