473,418 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

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

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
Nov 17 '05 #1
3 7685
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" <ar**********@hotmail.com> wrote in message
news:d2**************************@posting.google.c 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

Nov 17 '05 #2
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." <wf*********@kpmg.com> wrote in message news:<OI**************@TK2MSFTNGP12.phx.gbl>...
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" <ar**********@hotmail.com> wrote in message
news:d2**************************@posting.google.c 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

Nov 17 '05 #3
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" <ar**********@hotmail.com> wrote in message
news:d2**************************@posting.google.c 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." <wf*********@kpmg.com> wrote in message

news:<OI**************@TK2MSFTNGP12.phx.gbl>...
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" <ar**********@hotmail.com> wrote in message
news:d2**************************@posting.google.c 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

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jim Mitchell | last post by:
I have some code behind that generates 10 imagebutton controls.... I can not seem to figure out how to trap the onclick event for each image and determine which image was clicked. Can someone...
2
by: Brindley | last post by:
Hi there, In my Mdi application, I have placed a set of controls on the parent form to call child forms. The problem is that the controls hide the child forms. I have used SendToBack when Im...
2
by: Kelmen Wong | last post by:
how to work out a design to enable a child object to call its parent(creator/container) method/property? Its easy to be done if the child can know/assume its parent, but in my scenario, many...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
0
by: AndrewF | last post by:
Hi there. I am royally stuck with this so any help would be greatly appreciated. Basically I have a set of classes that create composite controls for the user. One of these is an upload object...
8
by: al | last post by:
Greetings, If I instansiate child forms in MDI parent, what is the way to close them. I can't find an event related to child to do such task. I want to close 3 child forms, all in the same...
3
by: Mark Rae | last post by:
Hi, Just a general quickie on setting properties of user controls from the parent form. Let's say I have a user control called note.ascx which displays a datagrid. That datagrid is populated...
2
by: DataSmash | last post by:
Hello, I've created a simple form with 2 radio boxes, 2 text boxes and a button. When I click the button, I'd like to write each "choice" to a text file. I can't figure out how to "link" the...
1
by: Bob Johnson | last post by:
..NET 3.5, Windows Forms app: My objective is to display parent/child data in two ComboBox controls, such that when a parent item is selected in one combo box, associated child items appear in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.