开发者

HtmlControl changing class

<div ID="btnWebL" runat="server" class="left_selected"></div>
                <asp:LinkButton ID="btnWeb" runat="server" CssClass="center_selected" OnCli开发者_开发技巧ck="btnWeb_Click"
                    Text="<%$ Resources:ViaMura.Web.Default, WebSearchButtonText %>"></asp:LinkButton>
                <div ID="btnWebR" runat="server" class="right_selected"></div>

i want to change btnWeb class to left_not_selected.

I try with:

HtmlControl btnWebL = FindControl("btnWebL") as HtmlControl;

but btnWebL does not have property for changing class. How can i change class?


You should be able to set the class attribute like so:

bntWebL.Attributes["class"] = "your_new_class";

See the documentation here.


Try this code

HtmlControl btnWebL = FindControl("btnWebL") as HtmlControl;
bntWebL.Attributes["class"] = "left_not_selected";

I hope this will work for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜