private void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand("SELECT * FROM Users", myConnection);
SqlDataAdapter ad = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
ad.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string alertBox = "alert('";
if (e.Row.RowType == DataControlRowType.DataRow)
{
alertBox += e.Row.RowIndex;
alertBox += "')";
e.Row.Attributes.Add("onclick", alertBox);
}
}