【问题标题】:Setting the 'pointed finger' cursor for individual rows in an asp.net gridview为asp.net gridview中的各个行设置“手指”光标
【发布时间】:2020-02-13 20:00:22
【问题描述】:

我在 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;
}

但是这些并不能抑制尖尖的手指。任何人都可以提出一种方法来实现这一目标吗?提前感谢您的帮助。我是新来的 - 如果之前有人问过这个问题但我没有找到,我们深表歉意。

【问题讨论】:

    标签: c# css asp.net


    【解决方案1】:

    怎么样:

    input[type="checkbox"] {
        cursor: pointer;
    }
    input[type="checkbox"]:disabled {
        cursor: default;
    }
    

    【讨论】:

    • 如果您满意,请采纳答案。谢谢;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-27
    • 1970-01-01
    • 2012-02-07
    • 2010-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多