protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = AssignStoreClerkGridView.Rows[e.RowIndex]; int storeClerkId = Convert.ToInt32((row.FindControl("StoreClerkIdList") as DropDownList).Text); String deptId = (row.FindControl("DeptIdTextBox") as Label).Text; AssignDepartment.updateStoreClerkDepartment(storeClerkId, deptId); AssignStoreClerkGridView.EditIndex = -1; AssignStoreClerkGridView.DataSource = AssignDepartment.getStoreClerkDepartmentList(); BindGrid(); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Updated successfully!');", true); }
protected void Page_Load(object sender, EventArgs e) { if (!Context.User.IsInRole("Store Supervisor")) { Response.Redirect("~/ErrorPages/Unauthorised"); } else { if (!IsPostBack) { DataBind(); AssignStoreClerkGridView.DataSource = AssignDepartment.getStoreClerkDepartmentList(); AssignStoreClerkGridView.DataBind(); } } }
private void BindGrid() { AssignStoreClerkGridView.DataSource = AssignDepartment.getStoreClerkDepartmentList(); AssignStoreClerkGridView.DataBind(); }