我想将 btnWeb 类更改为 left_not_selected。 我尝试: HtmlControl btnWebL = F-6ren">
gpt4 book ai didi

c# - HtmlControl 更改类

转载 作者:太空狗 更新时间:2023-10-30 00:21:43 25 4
gpt4 key购买 nike

<div ID="btnWebL" runat="server" class="left_selected"></div>
<asp:LinkButton ID="btnWeb" runat="server" CssClass="center_selected" OnClick="btnWeb_Click"
Text="<%$ Resources:ViaMura.Web.Default, WebSearchButtonText %>"></asp:LinkButton>
<div ID="btnWebR" runat="server" class="right_selected"></div>

我想将 btnWeb 类更改为 left_not_selected。

我尝试:

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

但 btnWebL 没有更改类的属性。我怎样才能改变类?

最佳答案

您应该能够像这样设置 class 属性:

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

参见 documentation here .

关于c# - HtmlControl 更改类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4174916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com