RE: Event Bubbling and Templated Controls

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello Mark,

For your scenario, the two properties(SelectedValue and SelectedText) need
to be updated according to some sub controls(in a Template) which is not
predefined, I agree that there is no perfect means here which can either
let the user put whatever controls they like in the template and let our
main custom control correctly update the two properties depend on those
unpredictable child control's events.

So far what I can get are the following options:

** If your custom control is designed to only support limited type of
controls (such as ListBox and DropDownList or TextBox) to raise change
event so as to change the SelectedValue and SelectedText properties, I
think you can consider check the control type (by the source ) of the
OnBubbleEvent to determine whether you need to call function to update the
properties.


** Another means is that you add some additional properties, such as a
"ChilldID" string property and a "ControlType" property. You'll have to let
the users of your custom control to set these two properties. These two
properties indicate the ID of the control in the template whose postback
event need to trigger the changing of the SelectedValue and SelectedText
property, and the type of that control in template. Thus, in your control's
OnBubbleEvent, you can check the source control with the two additional
properties to determine whether to do the modification.

How do you think on this? If you have any other ideas or questions on
this, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.




.


Quantcast