-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookEdit.aspx.cs
64 lines (51 loc) · 1.75 KB
/
BookEdit.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class BookEdit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCancel(object sender, GridViewCancelEditEventArgs e)
{
lblErrorMessage.Text = "";
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
String txtTitle_Val, txtPublisher_Val, txtDescription_Val;
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowState == DataControlRowState.Edit)
{
var txtTitle = row.FindControl("txtTitle") as TextBox;
var txtPublisher = row.FindControl("txtPublisher") as TextBox;
var txtDescription = row.FindControl("txtDescription") as TextBox;
txtTitle_Val = txtTitle.Text;
txtPublisher_Val = txtPublisher.Text;
txtDescription_Val = txtDescription.Text;
String err = "";
if (txtTitle_Val.Equals(""))
{
err += "Title cannot be empty \n";
e.Cancel = true;
}
if (txtPublisher_Val.Equals(""))
{
err += "***** Publisher cannot be empty *****";
e.Cancel = true;
}
if (txtDescription_Val.Equals(""))
{
err += "Description cannot be empty \n";
e.Cancel = true;
}
lblErrorMessage.Text = err;
}
}
}
}