Omer
Omer

Reputation: 317

cssClass set from the code behind

i tried set this <li>'s class from the code behind and id doesnt recognize the method cssClass:

the html:

<div id='settingNev' >
<ul >
  <li id="L1" class='unactive' runat="server"><a id="A1" onserverclick="show_view1" runat="server"><span>Personal</span></a></li>
  </li>
</ul>
</div>

code behind:

protected void show_view1(object sender, EventArgs e)
{
    this.MultiView1.ActiveViewIndex = 0;
    L1.cssClass = "active";
}

every thing work except the line L1.cssClass = "active";

what is the problem? how do i fix it?

Tnx for the help :D

Upvotes: 0

Views: 1217

Answers (1)

Sachin
Sachin

Reputation: 40970

You are accessing HTML controls. CssClass property won't be available with these controls. You need to use the Attribute.

myList.Attributes.Add("class","active")

Upvotes: 1

Related Questions