光标手符号更改

Rob*_*ood 2 c# asp.net gridview

我有一个Gridview.In这是2列,如图像和状态.在图像列中,某些图像将被禁用.为此,光标手符号不应该来.如何改变这一点.这是我的代码......

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="List.ascx.cs"
Inherits="List" %>
 <style type="text/css">
 .noHand 
 {
  cursor:default
 } 
 </style>
 ..........
 .........
  <asp:CommandField ButtonType="Image" ShowEditButton="True" HeaderText="Edit"        EditImageUrl="~/IMAGES/Edit.gif">
   <ItemStyle HorizontalAlign="Center" />
   </asp:CommandField>
Run Code Online (Sandbox Code Playgroud)

代码背后

protected void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
{  
       if (Status.Value == "True")
        {
           //Here Cursor Hand symbol should come
        }
        else
        {
          e.Row.Cells[9].CssClass = "nohand";
        }
}
Run Code Online (Sandbox Code Playgroud)

Nic*_*ein 7

尝试在单元格上使用CssClass属性:

e.Row.Cells[cellIndex].CssClass = "nohand";
Run Code Online (Sandbox Code Playgroud)

cellIndex 是每行上单元格的零基础索引.

然后在现有样式表中创建一个css类(或者创建一个新的样式表并从应用程序中引用它)nohand,其中包含该规则cursor:default;.