protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CustomerMethods cm = new CustomerMethods(); GridView1.DataSource = cm.ViewCustomer(); GridView1.DataBind(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("del")) { int cid = Convert.ToInt32(e.CommandArgument); CustomerMethods Op = new CustomerMethods(); int res = Op.Delete(cid); if (res > 0) { GridView1.DataSource = Op.ViewCustomer(); GridView1.DataBind(); Response.Write("Deactivated"); } } }