gpt4 book ai didi

c# - 获取 asp.net 网格单元格的内部按钮并使用 c sharp 更改其 css 属性?

转载 作者:行者123 更新时间:2023-11-28 03:07:28 25 4
gpt4 key购买 nike

我有一个网格,但是当我使用

隐藏它的单元格时
    GridView1.Rows[i].Cells[10].CssClass = "controlview";

和CSS类

  .controlview{
visibilty = hidden;
}

它也隐藏了单元格的边框,但我只想隐藏名称为按钮的单元格内的按钮使用 c sharp 如何在 tr 中访问 td 名称输入按钮

  GridView1.Rows[i].Cells[10].CssClass = "controlview";

这样我的网格单元格边框颜色就不会消失,只有按钮才能隐藏它

最佳答案

((Button)GridView1.Rows[i].Cells[10].FindControl("<Button ID>")).Attributes["class"] = "controlview";

((Button)GridView1.Rows[i].Cells[10].FindControl("<Button ID>")).Attributes.Add("style","display:none");

((Button)GridView1.Rows[i].Cells[10].FindControl("<Button ID>")).CssClass = "controlview";

((Button)GridView1.Rows[i].Cells[10].FindControl("<Button ID>")).Attributes.Add("style","visibility:hidden");

关于c# - 获取 asp.net 网格单元格的内部按钮并使用 c sharp 更改其 css 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31915738/

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