c# - 为asp.net gridview中的各个行设置“手指”光标
问题描述
我在 asp.net gridview 的模板字段中使用了 asp.net 复选框。通过在 .css 文件中包含以下内容,我将这些复选框设置为在将鼠标悬停在复选框上时使用“手指”光标:
input[type="checkbox"] {
cursor: pointer;
}
gridview 中的某些复选框将被禁用。这是使用 gridview 的 RowDataBound 事件在代码中设置的:
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
[various code to set up a chkbox variable]
if ( [various conditions] )
{
chkbox.Enabled = false;
}
else
{
chkbox.Enabled = true;
}
}
}
以上所有工作。我还想做的是在将鼠标悬停在禁用的复选框上时停止光标变为指向手指。我尝试设置 chkbox 的 ID 和 CssClass 属性,并包括合适的附加 CSS 语句。例如
chkbox.Enabled = false;
chkbox.CssClass = "nohand";
在 .css 文件中:
.nohand {
cursor: default;
}
但是这些并没有压制手指。任何人都可以提出一种方法来实现这一目标吗?提前感谢您的帮助。我是新来的 - 如果之前有人问过这个问题但我没有找到它,我很抱歉。
解决方案
关于什么:
input[type="checkbox"] {
cursor: pointer;
}
input[type="checkbox"]:disabled {
cursor: default;
}
推荐阅读
- php - 如何根据数据库中的值将复选框设置为“已选中”?
- php - 用 jquery 添加 PHP
- spring-boot - 是否有端点可以在 Spring Security OAuth 应用程序中获取配置的公共证书?
- mysql - 无法在 openfire mysql 数据库中创建表
- tensorflow - RETURNN 自定义层搜索模式断言错误
- json - JSON 未在 VBA Excel 2010 中收集数据
- c# - /Date(1537909200000)/ 我在“AngularJS”中有日期格式问题
- python - 在执行逻辑回归时,我得到了错误:LinAlgError: Singular matrix
- shell - 如何让一个 Makefile 调用另一个 Makefile 规则?
- css - 如何管理旧的 CSS 类?