Example #1
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                GridViewRow row  = GridView1.Rows[e.RowIndex];
                string      id   = (row.FindControl("lblId") as Label).Text;
                string      name = (row.FindControl("txtName") as TextBox).Text;


                db.EditBook(int.Parse(id), name);
            }
            catch (Exception ex)
            {
                exceptionLable.Text = ex.Message;
            }
            finally
            {
                GridView1.EditIndex = -1;
                this.BindGrid();
            }
        }