views:

75

answers:

0

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?

UPDATE: For clearance: The <li> is of type webcontrol. I want to use the <li> with an onclick, so I need to use the sender. Because of that, I need to cast the <li> to an HtmlGenericControl. this doesn't work... got anyone the solution?