If I have a label control with allowHtml = true, and .text of “Please click <a href=#here>here</a> to say hello world.”
How can I get the event – like a linkClicked event – if they click just the portion of the text that is the anchor (i.e. the regular click gets fired for non anchor parts of the text)
Is this possible? The htmlPanel h as ElementClicked which works for this purpose, but I’d be interested in doing this for label controls in particular.
Thanks in advance,
this can be accomplished by using the role property and handling the MouseClick event.
Simply add a role attribute to the HTML hyperlink and query it as e.Role in your MouseClick event handler.
Please note that the Click event handle does not have any arguments, so you need to use MouseClick or MouseDown.
With using different role properties you could also have multiple links in a label and handle each link separately.
Hope that helps.
Please login first to submit.