Last post Mar 15, 2009 09:58 PM by Allen Chen – MSFT
Mar 14, 2009 03:06 PM|user_resu|LINK
I have a custom control “AddressPicker” that displays dynamic address information of a user. BY dynamic I mean based on the database call it checks how may addresses a user has and
it displays it. There is a “Use this Address” button at the bottom of each address information which is generated dynamically too as a part of CreateChildControl. If a user click on this button I need to pass this information to another custom control namely
“AddressConsumer” which in turn uses this information for further processing.My Controls are inherited WebCOntrol,INamingContainer
I am using the event delegate mechanism to pass information from one control to other
This is a code snippet from AddressPicker control
This is the “Use This Address”
void btnUseThisAddress_Click(object sender,
AddressClickEventArgs args =
This is a code snippet from AddressConsumer control.
void AddressClick(object sender,
txtAddress1.Text = args.Address1;
I am testing this Controls by dropping them on a Web Page and implementing
Here is how I am creating Child Controls & Rendering it
foreach(ADDRESS IN THE ADDRESSLIST)
WELL HERE IS THE PROBLEM…… IT WORKS FINE WHEN USER HAS ONLY ONE ADDRESS INFORMATION. BUT WHEN THE USER HAS MORE THAN ONE INFORMATION WHEN I CLICK ON “USE THIS ADDRESS” BUTTON IT
ALWAYS PASSES THE SAME VALUEs IRRESPECTIVE OF WHICH BUTTON I CLICKED.
After reading lot of forums I
guess the part of the problem is I may have to use RaiseBububble and OnBUbble
PLUS I need to add all the child controls in a container in a ControlCollection
so that it can uniquely identify the child control while generating it dynamically but I am not sure how to incorporate in this scenario. Any help would be greatly appreciated.
OR COULD SOMEONE PLEASE POINT ME TO ANY ARTICLE SIMILAR TO ABOVE SITUATION OR POST A CODE SNIPPET FOR THE FOLLOWING SCENARIO LISTED BELOW :
"Adding a TextBox and a BUtton as One Control and then repeatedly adding this Control to a Container in a Control collection and then later on using a ONBubble and RaiseBubble
to find out exactly which Button is clicked and extracting clicked button corresponding TextBox value."
Mar 15, 2009 09:58 PM|Allen Chen – MSFT|LINK
"Adding a TextBox and a BUtton as One Control and then repeatedly adding this Control to a Container in a Control collection and then later on using a ONBubble and RaiseBubble to find out exactly which Button is clicked and
extracting clicked button corresponding TextBox value."
If this is what you need you can try the following code: