private void dgPNotice_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {

//为数据项添加鼠标单击属性
        for(int i = 1; i<=9; i++)
        e.Item.Cells[i].Attributes.Add("onclick", " window.open('ViewPNotice.aspx?id="+e.Item.Cells[1].Text+"','','left=200px,top=100px,width=800px,height=600px,scrollbars=yes,resizable=yes' ) ");
    
  } 
如何使鼠标在移到每行数据的时候变成手型?我只知道style.cursor ="hand";在DataGrid中不知道如何设置?谢谢啦!!

解决方案 »

  1.   

    在所在行的tr标签中加入
    onMouseOver="style.cursor ='hand'"
    试试
      

  2.   

    if (itemType == ListItemType.Item ) 

     e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor=’#FFFFFF’;"; 
     e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ; 
    }
      

  3.   

    if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
    {
    e.Item.Attributes.Add("onclick","this.style.cursor='hand';");
    }