protected void Page_Load(object sender, EventArgs e) { User u = (User)Session["UserEntity"]; if (u == null || u.RoleId != 5) { Response.Redirect("../Security.aspx"); } if (!IsPostBack) { //User userbean = (User)Session["UserEntity"]; //Supervisor.Text = "Hello," + userbean.Name; List <Department> listDepartment = df.GetDepName(); DropDownListDepartment.DataSource = listDepartment; DropDownListDepartment.DataTextField = "deptName"; DropDownListDepartment.DataValueField = "deptName"; DropDownListDepartment.DataBind(); List <RequestItem> listCategary = rif.GetCategoryName(); DropDownListCategory.DataSource = listCategary; DropDownListCategory.DataTextField = "CategoryName"; DropDownListCategory.DataValueField = "CategoryName"; DropDownListCategory.DataBind(); } }
/// <summary> /// Gets the for Lookup Fields /// </summary> private void GetDataForDropDownLists() { GetCountries(); string sqlQuery = "select DEPT_ID, DEPT_NAME from M_DEPARTMENTS where REC_ACTIVE = 1 order by DEPT_NAME;select INDUSRTY_TYPE_ID, INDUSRTY_TYPE_NAME from M_INDUSTRY_TYPE where REC_ACTIVE = 1 order by INDUSRTY_TYPE_NAME;select JOBFUNC_ID, JOBFUNC_NAME from M_JOBFUNCTION where REC_ACTIVE = 1 order by JOBFUNC_NAME;select MFPMODEL_ID, MFPMODEL_NAME from M_MFPMODELS where REC_ACTIVE = 1 order by MFPMODEL_NAME;select ORG_TYPE_ID, ORG_TYPE_NAME from M_ORGANISATION_TYPE where REC_ACTIVE = 1 order by ORG_TYPE_NAME"; DataSet dsMasterData = DataProvider.GetSqlData(sqlQuery); DropDownListDepartment.DataSource = dsMasterData.Tables[0]; DropDownListDepartment.DataValueField = "DEPT_ID"; DropDownListDepartment.DataTextField = "DEPT_NAME"; DropDownListDepartment.DataBind(); DropDownListIndustryType.DataSource = dsMasterData.Tables[1]; DropDownListIndustryType.DataValueField = "INDUSRTY_TYPE_ID"; DropDownListIndustryType.DataTextField = "INDUSRTY_TYPE_NAME"; DropDownListIndustryType.DataBind(); DropDownListJobFunction.DataSource = dsMasterData.Tables[2]; DropDownListJobFunction.DataValueField = "JOBFUNC_ID"; DropDownListJobFunction.DataTextField = "JOBFUNC_NAME"; DropDownListJobFunction.DataBind(); DropDownListMFPModel.DataSource = dsMasterData.Tables[3]; DropDownListMFPModel.DataValueField = "MFPMODEL_ID"; DropDownListMFPModel.DataTextField = "MFPMODEL_NAME"; DropDownListMFPModel.DataBind(); DropDownListOrganizationType.DataSource = dsMasterData.Tables[4]; DropDownListOrganizationType.DataValueField = "ORG_TYPE_ID"; DropDownListOrganizationType.DataTextField = "ORG_TYPE_NAME"; DropDownListOrganizationType.DataBind(); //GetStates(); GetRegistrationTypes(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownListDepartment.DataSource = DAL.GetDepartments(); DropDownListDepartment.DataBind(); DropDownListManager.DataSource = DAL.GetEmployeeIdAndName(); DropDownListManager.DataBind(); DropDownListManager.Items.Add(new ListItem("--Select--", "0")); DropDownListManager.SelectedValue = "0"; RangeValidator2.MaximumValue = DateTime.Now.ToShortDateString(); RangeValidator2.MinimumValue = DateTime.Now.AddYears(-100).ToShortDateString(); } }
protected void LoadCombos() { //Load Combos DataTable dtPlants = DBUtils.SQLSelect(new SqlCommand("SELECT [Plant_Id],[Plant_Name] FROM [tbl_Plant_Master]")); DropDownListPlant.DataValueField = "Plant_Id"; DropDownListPlant.DataTextField = "Plant_Name"; DropDownListPlant.DataSource = dtPlants; DropDownListPlant.DataBind(); DataTable dtDepartments = DBUtils.SQLSelect(new SqlCommand("SELECT [Department_Id],[Department_Name] FROM [tbl_Department_Master]")); DropDownListDepartment.DataValueField = "Department_Id"; DropDownListDepartment.DataTextField = "Department_Name"; DropDownListDepartment.DataSource = dtDepartments; DropDownListDepartment.DataBind(); }
public void BindDropDown() { IList <BaseDataDepartment> baseDataDepartment = bugInquiryBiz.SelectBaseDataDepartmentNameId(); DropDownListDepartment.DataSource = baseDataDepartment; DropDownListDepartment.DataTextField = "Name"; DropDownListDepartment.DataValueField = "Id"; DropDownListDepartment.DataBind(); DropDownListDepartment.Items.Insert(0, ""); ViewState["baseDataDepartment"] = baseDataDepartment; IList <BaseDataDomain> baseDataDomainList = baseDataDomainBiz.SelectBaseDataDomain(null); DropDownListDomain.DataSource = baseDataDomainList; DropDownListDomain.DataTextField = "Name"; DropDownListDomain.DataValueField = "Id"; DropDownListDomain.DataBind(); DropDownListDomain.Items.Insert(0, ""); ViewState["baseDataDomainList"] = baseDataDomainList; }
private void BindDropDownList() { try { PmsSysBiz pmsSysBiz = new PmsSysBiz(); IList <PmsSys> pmsSysList = new List <PmsSys>(); pmsSysList = pmsSysBiz.SelectData1ByType("PM", "RDDept"); DropDownListDepartment.DataSource = pmsSysList; DropDownListDepartment.DataTextField = "data1"; DropDownListDepartment.DataValueField = "data1"; DropDownListDepartment.DataBind(); DropDownListDepartment.Items.Insert(0, new ListItem()); DropDownListDepartment.Items[0].Text = ""; DropDownListDepartment.Items[0].Value = ""; } catch { ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Bind DropDownList failure');", true); } }
private void LoadDDLDepartment() { listDepartment = dept.LoadDepartament(_x, "Empresa", DropDownListCompany.SelectedItem.Value, "Ramais");//new if (listDepartment != null && listDepartment.Count > 0) { listDepartment.Insert(0, new Department() { Name = "" }); //50000 value since 0 is an ID used in XML //Id = 50000, DropDownListDepartment.Visible = true; DropDownListDepartment.DataSource = listDepartment; DropDownListDepartment.DataBind(); } else { DropDownListDepartment.Visible = false; } //ButtonAdd.Visible = false;//Js GridViewExtentionLines.DataSource = null; GridViewExtentionLines.DataBind(); }