Example #1
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow   row      = GridView1.Rows[e.RowIndex];
            int           authorId = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);
            AuthorManager manager  = new AuthorImpXMLManager();
            Author        author   = new Author();
            string        date     = Request.Form["txtBirthdate"];

            author.Id        = authorId;
            author.Name      = (row.FindControl("txtName") as TextBox).Text;
            author.LastName  = (row.FindControl("txtLastName") as TextBox).Text;
            author.BirthDate = Convert.ToDateTime(date);
            manager.Update(authorId, author);
            GridView1.EditIndex = -1;
            this.BindGrid();
        }