Cast ASP type object to HtmlControl

Posted by Joris on Stack Overflow See other posts from Stack Overflow or by Joris
Published on 2010-06-03T21:52:21Z Indexed on 2010/06/03 21:54 UTC
Read the original article Hit count: 329

Filed under:
|
|
|
|

Hey'all

How do I cast a li dom element as HtmlControl from an ASP type object?

I tried it like this:

var li = (HtmlControl)sender;

I get a InvalidCastException... The thing is, I want to make the li (a tab) clickable, and then update an UpdatePanel... But when I start like this

<li id="li" runat="server" onclick="tab2_Click"> FooBar </li>

I get an error because the object is not defined...

how to cast?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET