后台设置:
 Public Sub dgList_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            '---  增加鼠标效果 OnMouseOver / OnMouseOut                
            e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'")
            e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#eeeeff'")            '---  改变特定 Cell (Column) 的鼠标式样(Or you may do it for a whole Row of DataGrid :)                
            e.Item.Cells(1).Style("cursor") = "hand"
end if
end sub

解决方案 »

  1.   

    C#的,试试
    private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
    e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#336699'");
    e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");

    }
    }
      

  2.   

    js
    function document.onclick()
    {
    try
    {
    var ObjTable = document.all.DataGrid1;//DataGrid1改成你的id名
    if(ObjTable.contains(event.srcElement) == true)
    {
    var ThisObj = event.srcElement;
    while(ThisObj.tagName != "TR") ThisObj = ThisObj.parentNode;

    if(ThisObj != ObjTable.rows[0] && ThisObj != ParentObj)
    {
    ThisObj.style.color = 'FF0000';
    if(ParentObj != null)
    {
    ParentObj.style.color = '000000';
    }
    ParentObj = ThisObj;
    }
    }
    }
    catch(e){}
    }
      

  3.   

    if (e.Item.ItemIndex != -1)
    {
    e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#bfd4e6'");
    e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='#fafafa'");
    }
    在itemcreate中写上面的代码。
      

  4.   

    后台设置:
     Public Sub dgList_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
            If e.item.itemIndex<>-1 Then
                '---  增加鼠标效果 OnMouseOver / OnMouseOut                
                e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'")
                e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#eeeeff'")            '---  改变特定 Cell (Column) 的鼠标式样(Or you may do it for a whole Row of DataGrid :)                
                e.Item.Cells(1).Style("cursor") = "hand"
    end if
    end sub
      

  5.   

    to 峰 和各位:
             我用你的方法试过了,成功了!
             如果我在DataGrid上的一行单击,这个单击所触发的事件是什么!
      

  6.   

    to jouzen()
    如何绑定事件,举个例子!
              谢谢!