protected void Page_Load(object sender, EventArgs e) { if (Session["UserProfile"] == null) { Response.Redirect("/Default.aspx"); } if (!Page.IsPostBack) { if (eType == "add") { } else if (eType == "edit") { bindData(); } else if (eType == "delete") { softDeleteData(eID); } } lblMenu.Text = "Entry Master User"; Session["activepage"] = "user"; if (!Page.IsPostBack) { Models.PenjaminanDatasetTableAdapters.DivisiTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.DivisiTableAdapter(); Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter taRole = new Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter(); DropDownList1.DataSource = (PenjaminanDataset.DivisiDataTable)ta.GetData(); DropDownList1.DataBind(); RoleList.DataSource = (PenjaminanDataset.u_roleDataTable)taRole.GetData(); RoleList.DataBind(); //set jadi kosong ketika add new if (eType == "edit") { PenjaminanDataset.UserProfileRow dr = UserProfile.selectUserProfileByID(eID); tDivisiID = Convert.ToInt16(dr.division); tRoleID = Convert.ToInt16(dr.role); DropDownList1.SelectedValue = tDivisiID.ToString(); RoleList.SelectedValue = tRoleID.ToString(); } //else if(eType == "add") //{ // DropDownList1.SelectedValue = " "; // RoleList.SelectedValue = " "; //} //DropDownList1.DataTextFormatString = "{0} - {1}"; //DropDownList1.DataTextField = "ID,NamaDivisi"; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserProfile"] == null) { Response.Redirect("/Default.aspx"); } if (!Page.IsPostBack) { if (eType == "add") { } else if (eType == "edit") { bindData(); } else if (eType == "delete") { softDeleteData(eID); } } lblMenu.Text = "Entry Master Access"; Session["activepage"] = "Access"; if (!Page.IsPostBack) { Models.PenjaminanDatasetTableAdapters.tPageTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.tPageTableAdapter(); Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter taRole = new Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter(); PageList.DataSource = (PenjaminanDataset.tPageDataTable)ta.GetData(); PageList.DataBind(); RoleList.DataSource = (PenjaminanDataset.u_roleDataTable)taRole.GetData(); RoleList.DataBind(); if (eType == "edit") { PenjaminanViewDataset.AccessRow dr = Access.selectAccessByID(eID); tPageID = Convert.ToInt16(dr.fk_page); tRoleID = Convert.ToInt16(dr.fk_role); PageList.SelectedValue = tPageID.ToString(); RoleList.SelectedValue = tRoleID.ToString(); } } }
private void BindData() { Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter ta = new Models.PenjaminanDatasetTableAdapters.u_roleTableAdapter(); Session["roleDt"] = (PenjaminanDataset.u_roleDataTable)ta.GetData(); }