protected void SectorU_SelectedIndexChanged(object sender, EventArgs e) { if (SectorU.SelectedValue != "") { AdminsU.DataSource = Obj.GetDataSetByID("GetAdministrations", Convert.ToInt32(SectorU.SelectedValue)); // Bind the Admins (Administrations) DropdownList AdminsU.DataTextField = "AdmName"; // Set the text in the dropdown list AdminsU.DataValueField = "AdmID"; // Set the value in the dropdown list AdminsU.DataBind(); AdminsU.Items.Insert(0, ""); } }
protected void Edit_Command(object sender, CommandEventArgs e) // Edit Button in Reapeater (Employees Data Grid) { CloseAll(); LblCase.Text = "> تسجيل بيانات المستخدم "; Updat.Attributes.Remove("style"); Updat.Style.Add("display", "block"); SectorU.DataSource = Obj.GetDataSet("GetSections"); // fill the AdminsU (Administrations Dropdownlist in Editing Window) SectorU.DataTextField = "SectionName"; SectorU.DataValueField = "SectionID"; SectorU.DataBind(); SectorU.Items.Insert(0, ""); LblEdit.Text = ""; Suc.Visible = false; DataSet Ds = new DataSet(); Ds = Obj.GetDataSetByID("GetEmployeeByID", Convert.ToInt32(e.CommandArgument)); // Get the data for the selected Employee if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { LblEdit.Text = "A"; // Have to set the Label with "A" to check in Javascript if ==A will open the editing window foreach (DataRow Row in Ds.Tables[0].Rows) { // Fill the Editig Feilds Img1U.Src = Convert.ToString(Row["EmpImg"]); AdminsU.DataSource = Obj.GetDataSetByID("GetAdministrations", Convert.ToInt32(Row["SectionID"])); // Bind the Admins (Administrations) DropdownList AdminsU.DataTextField = "AdmName"; // Set the text in the dropdown list AdminsU.DataValueField = "AdmID"; // Set the value in the dropdown list AdminsU.DataBind(); AdminsU.Items.Insert(0, ""); AdminsU.SelectedValue = Convert.ToString(Row["AdmID"]); EmpNameU.Value = Convert.ToString(Row["EmpName"]); PassordU.Attributes.Add("value", Convert.ToString(Row["EmpPassword"])); Passord2U.Attributes.Add("value", Convert.ToString(Row["EmpPassword"])); SaveUpdates.CommandArgument = Convert.ToString(Row["EmpID"]); //EmpJobCodeU.Value = Convert.ToString(Row["EmpJobCode"]); JobNameU.Value = Convert.ToString(Row["EmpJobTitle"]); EmailU.Value = Convert.ToString(Row["EmpEmail"]); AddReportsU.Checked = Convert.ToBoolean(Row["ApprovPermission"]); var a = Convert.ToString(Row["SectionID"]); SectorU.SelectedValue = Convert.ToString(Row["SectionID"]); AdminsU.SelectedValue = Convert.ToString(Row["AdmID"]); CheckRecivU.Checked = Convert.ToBoolean(Row["Reciv"]); CheckAdminU.Checked = Convert.ToBoolean(Row["SystemAdmin"]); } } else { LblEdit.Text = ""; } }