On GridView add OnRowDataBound handler
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" OnRowDataBound="grd_OnRowDataBound">
And Code behind
public void grd_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick",String.Format("javascript:alert('You clicked {0}')", e.Row.RowIndex));
}
}