-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateBook.aspx.cs
45 lines (37 loc) · 1.06 KB
/
UpdateBook.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class UpdatePaintingForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if ( ! IsPostBack)
databind();
}
private void databind()
{
gvPainting.DataSource = BookDB.getAllBook();
gvPainting.DataBind();
}
protected void gvPainting_RowEditing(object sender, GridViewEditEventArgs e)
{
gvPainting.EditIndex = e.NewEditIndex;
databind();
}
protected void gvPainting_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gvPainting.EditIndex = -1;
databind();
}
protected void gvPainting_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
List<Book> books = (List<Book>)Application["books"];
Book p = books[e.RowIndex];
p.Price = Convert.ToDecimal(e.NewValues["Price"]);
gvPainting.EditIndex = -1;
databind();
}
}