开发者

Cursor Hand Symbol Change

I am having a Gridview.In that ther are 2 columns,like Image and Status. In image columns some of the images will be disabled. For that,the Cursor Hand Symbol should not come.How to change this. Here is my code...

<%@ 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>

Code Behind

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";
  开发者_Go百科      }
}


Try using the CssClass property on the cells:

e.Row.Cells[cellIndex].CssClass = "nohand";

cellIndex being a zero based index of your cells on each row.

Then create a css class in your existing stylesheet (or create a new stylesheet and reference it from your application) called nohand that includes the rule cursor:default;.


You'd have to link up with a CSS Class that has the cursor property set. Wherever you have code to emit a disabled image command, also put out some css that sets your cursor accordingly.

http://www.w3schools.com/css/pr_class_cursor.asp

So create a CSS class something like this:

noHand {cursor:default}

And make sure it's set for disabled columns. @Nick's answer looks like it would do just that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜