-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddbranch.aspx.cs
More file actions
71 lines (65 loc) · 2.25 KB
/
Addbranch.aspx.cs
File metadata and controls
71 lines (65 loc) · 2.25 KB
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
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Addbranch : System.Web.UI.Page
{
DS_BRANCH.BRANCH_SELECTDataTable BDT = new DS_BRANCH.BRANCH_SELECTDataTable();
DS_BRANCHTableAdapters.BRANCH_SELECTTableAdapter BAdapter = new DS_BRANCHTableAdapters.BRANCH_SELECTTableAdapter();
protected void Page_Load(object sender, EventArgs e)
{
lblmsg.Text = "";
if (Page.IsPostBack == false)
{
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
}
}
protected void btnadd_Click(object sender, EventArgs e)
{
BAdapter.Insert(txtaddbranch.Text);
lblmsg.Text = "Branch Inserted";
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
txtaddbranch.Text = "";
txtaddbranch.Focus();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int bid= Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
BAdapter.Delete(bid);
lblmsg.Text = "Branch Deleted";
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int bid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
TextBox bname = GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox;
BAdapter.Update(bid, bname.Text);
lblmsg.Text = "Branch Updated";
GridView1.EditIndex = -1;
BDT = BAdapter.SelectBranch();
GridView1.DataSource = BDT;
GridView1.DataBind();
}
}