protected void gvAddress_RowDataBound(object sender, GridViewRowEventArgs e)
        {
 
            e.Row.Attributes.Add("onmousemove", "this.style.cursor='default'");
 
        }一个简单的例子。

解决方案 »

  1.   

    .cs:
        
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string id = "2";
            e.Row.Attributes.Add("onclick", "return Check("+id+");");    }HTML:
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript">
        function Check(id)
        {
            alert(id);
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:GridView  ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound">
            </asp:GridView>
        </div>
        </form>
    </body>
    </html>