ASP Dot Codes
ASP Dot Codes
}
protected void BindData()
{
SqlConnection conn = new SqlConnection(strconn);
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
comm.CommandText = "select * from hotel";
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
if (dr.HasRows)
{
GridView1.DataSource = dr;
GridView1.DataBind();
}
conn.Close();
}
RowEditing
RowCancelingEdit
RowUpdating
To do editing convet all label to text boxes for the row that we want to allow edit
conn.Close();
GridView1.EditIndex = -1;
BindData();