We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

BaseElement array

Thread ID:

Created:

Updated:

Platform:

Replies:

26079 Mar 13,2005 08:04 PM UTC Mar 15,2005 03:55 PM UTC WinForms 1
loading
Tags: HTMLUIControl
Mike
Asked On March 13, 2005 08:04 PM UTC

I am evaluating HtmlUI and trying to get a handle on how I should use it for my situation properly. I need to dynamically build an html document with a variable number of buttons. I have the document built and htmlui works great. I have a qustion on how to properly structure the events to handle the button clicks. Currently I am ... Dim policyBtn() As BaseElement policyBtn(polCnt) = htmlelements(polName) I am currently creating a seperate event handler for each button in the policyBtn array and it works great. However I would like to create a single event handler and in the Click event determine which button was clicked either by index or element name. Is there a straightforward way of doing this? Thanks

Davis Jebaraj [Syncfusion]
Replied On March 15, 2005 03:55 PM UTC

Hi Mike, The HTMLUIControl supports bubbling events. If some element raises an event (for instance Click), the parent elements also raise the same event if they support it. This allows us to handle the Click event of a top level Element and get the BubblingEventArgs using the static HTMLUIControl.GetBubblingEventArgs( EventArgs e) method. The RootSender of the BubblingEventArgs is the Button that was clicked: private void body_OnClick(object sender, EventArgs e) { BubblingEventArgs bargs = HTMLUIControl.GetBublingEventArgs(e); BaseElement elem = bargs.RootSender as BaseElement; if( elem != null && elem is INPUTElementImpl) { if(elem.ID == "Button1") { Console.WriteLine("Button 1 clicked"); } else if(elem.ID == "Button2") { Console.WriteLine("Button 2 clicked"); } else if(elem.ID == "Button3") { Console.WriteLine("Button 3 clicked"); } else if(elem.ID == "Button4") { Console.WriteLine("Button 4 clicked"); } } } Please refer to the sample linked to below: http://www.syncfusion.com/support/user/uploads/htmluibubblingevents.zip Thanks, Davis

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;