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

标签 c# jquery html css asp.net

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

隐藏它的单元格时
    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/

相关文章:

c# - 在 Python 中压缩并使用解压缩 C# 解压缩的最简单方法(反之亦然)

c# - 如何在 xunit 中使用最小起订量测试返回 IEnumerable<model> 的异步任务<IActionResult>?

jquery - jquery中的div标签事件

javascript - 组合两个更改功能

jquery - 使用 html 和 css 创建动态储 jar 液位/仪表

c# - 将 QT/C++ 转换为 C#

c# - 在 C# 中编辑现有的 Excel 文件。异常

javascript - 如何选择第一个 child ?

javascript - HTML 和 Javascript - 如何模拟禁用输入(隐藏插入符)?

c# - 将选择设置为 View 框