public void BindDrpDepartment() { BLLCollection <Department_mst> col = new BLLCollection <Department_mst>(); Department_mst Objdepartment = new Department_mst(); int Selectedsiteval = Convert.ToInt32(DrpSite.SelectedValue); if (Selectedsiteval == 0) { DrpDepartment.DataSource = col; DrpDepartment.DataBind(); ListItem item = new ListItem(); item.Text = "--------------Select---------------"; item.Value = "0"; DrpDepartment.Items.Add(item); DrpDepartment.SelectedValue = "0"; } else { col = Objdepartment.Get_All_By_SiteId(Selectedsiteval); DrpDepartment.DataTextField = "departmentName"; DrpDepartment.DataValueField = "deptid"; DrpDepartment.DataSource = col; DrpDepartment.DataBind(); ListItem item = new ListItem(); item.Text = Resources.MessageResource.errSelectDept.ToString(); item.Value = "0"; DrpDepartment.Items.Add(item); DrpDepartment.SelectedValue = "0"; } }
protected void Page_Load(object sender, EventArgs e) { //Getting the item id from session from the admin form page _itemId = Convert.ToInt32(Session["ItemId"]); if (!IsPostBack) { //Getting the item id from session from the admin form page _itemId = Convert.ToInt32(Session["ItemId"]); //Setting the dropdown to all the departments from the Departments table _departments = _departmentDao.GetDepartments(); DrpDepartment.DataSource = _departments; DrpDepartment.DataTextField = "Name"; DrpDepartment.DataValueField = "Id"; DrpDepartment.DataBind(); DrpDepartment.SelectedIndex = 0; if (Session["Item"] is Item item) { //If it isn't null, display item properties to user TxtDescription.Text = item.Description; TxtName.Text = item.Name; TxtPrice.Text = item.Price.ToString(); //Setting pin location on map SetPin(item.Location); hidFinalCoords.Value = item.Location; } } }
protected void BindDept(string Role) { Processing P = new Processing(); DrpDepartment.DataSource = P.BindDepartmentForBlocking(Role); DrpDepartment.DataTextField = "Dept"; DrpDepartment.DataValueField = "ID"; DrpDepartment.DataBind(); }
protected void DrpDepartment_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List <EmpSea.EmlpoyeeSeachEditEmp> empsrch = Proxy.RetriveDepartment(); DrpDepartment.DataSource = empsrch; DrpDepartment.DataTextField = "Dep"; DrpDepartment.DataValueField = "EmpID"; ListItem l = new ListItem(); l.Text = "Select Designation"; l.Value = "-1"; DrpDepartment.AppendDataBoundItems = true; DrpDepartment.Items.Add(l); DrpDepartment.DataBind(); } }