protected void delete(object sender, GridViewDeleteEventArgs e) { CPT_RoleMaster Roledetails = new CPT_RoleMaster(); int id = int.Parse(gvRole.DataKeys[e.RowIndex].Value.ToString()); Roledetails.RoleMasterID = id; RoleMasterBL deleteRole = new RoleMasterBL(); deleteRole.Delete(Roledetails); BindGrid(); }
protected void RoleAddButton_Click(object sender, EventArgs e) { try { CPT_RoleMaster Roledetails = new CPT_RoleMaster(); Roledetails.RoleName = RoleNameTextBox.Text; Roledetails.Show_in_Dropdown = true; Roledetails.IsActive = true; RoleMasterBL insertRole = new RoleMasterBL(); insertRole.Insert(Roledetails); BindGrid(); CleartextBoxes(this); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected void update(object sender, GridViewUpdateEventArgs e) { try { CPT_RoleMaster Roledetails = new CPT_RoleMaster(); int id = int.Parse(gvRole.DataKeys[e.RowIndex].Value.ToString()); Roledetails.RoleMasterID = id; string RoleName = ((TextBox)gvRole.Rows[e.RowIndex].Cells[1].Controls[0]).Text; DropDownList ddl = (DropDownList)gvRole.Rows[e.RowIndex].FindControl("ddlShow"); Roledetails.RoleName = RoleName; Roledetails.Show_in_Dropdown = ddl.SelectedValue == "0"? false : true; RoleMasterBL updateRole = new RoleMasterBL(); updateRole.Update(Roledetails); gvRole.EditIndex = -1; BindGrid(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }