Exemple #1
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int BookId = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Values[0]);

            UserBusinessLogic.DeleteBooks(BookId);
            BindGrid();
        }
Exemple #2
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = GridView2.Rows[e.RowIndex];

            int BookId = Convert.ToInt32((row.FindControl("TextBox5") as TextBox).Text);

            string Title = (row.FindControl("TextBox7") as TextBox).Text;

            int CategoryID = Convert.ToInt32((row.FindControl("TextBox6") as TextBox).Text);

            string ISBN = (row.FindControl("TextBox1") as TextBox).Text;

            string Author = (row.FindControl("TextBox2") as TextBox).Text;

            int Stock = Convert.ToInt32((row.FindControl("TextBox3") as TextBox).Text);

            decimal Price = Convert.ToDecimal((row.FindControl("TextBox4") as TextBox).Text);

            UserBusinessLogic.UpdateBooks(BookId, Title, CategoryID, Author, ISBN, Stock, Price);
            GridView2.EditIndex = -1;
            BindGrid();
        }
Exemple #3
0
 private void BindGrid()
 {
     GridView2.DataSource = UserBusinessLogic.Listbook();
     GridView2.DataBind();
 }