//end bind combos //not in use protected void dxcbocompany_DataBound(object sender, EventArgs e) { //11/03/2011 append ALL option as 1st item in dropdown DevExpress.Web.ASPxEditors.ListEditItem _li = new DevExpress.Web.ASPxEditors.ListEditItem("(All)", "-1"); this.dxcbocompany.Items.Insert(0, _li); //default to all users this.dxcbocompany.SelectedIndex = 0; }
public void FillCustomerComboBox() { DataTable dt = CustomerServiceBL.CustomerDetails.Ins.GetAllCustomerData(); DevExpress.Web.ASPxEditors.ListEditItem item = new DevExpress.Web.ASPxEditors.ListEditItem("Select All", 0); CustomerComboBox.DataSource = dt; CustomerComboBox.TextField = "Name"; CustomerComboBox.ValueField = "ID"; CustomerComboBox.DataBind(); CustomerComboBox.Items.Insert(0, item); CustomerComboBox.SelectedIndex = 0; }
protected void ASPxComboBox1_DataBound(object sender, System.EventArgs e) { //By value int iterator = 0; for (iterator = 0; iterator < ASPxComboBox1.Items.Count; iterator++) { DevExpress.Web.ASPxEditors.ListEditItem currentItem = ASPxComboBox1.Items[iterator]; if (currentItem.Value.ToString() == "213-46-8915") { ASPxComboBox1.SelectedItem = currentItem; } } //OR by display text //ASPxComboBox1.SelectedIndex = ASPxComboBox1.Items.IndexOfText("Chris"); }
//end bind dll archive protected void bind_combos() { //company if company is not -1 (WWI employee) if (Session["user"] != null) { Int32 _companyid = (Int32)((UserClass)Page.Session["user"]).CompanyId; Int32 _officeid = (Int32)((UserClass)Page.Session["user"]).OfficeId; if (_companyid != -1) //bind contacts for this company { //contact names Query _qry = new Query(Tables.ContactTable, "WWIprov").AddWhere("CompanyID", Comparison.Equals, _companyid).ORDER_BY("ContactName", "asc"); ContactTableCollection _contact = new ContactTableCollection(); _contact.LoadAndCloseReader(_qry.ExecuteReader()); DataTable _dt = (DataTable)_contact.ToDataTable(); this.cboName.DataSource = _dt; this.cboName.ValueField = "ContactID"; this.cboName.TextField = "ContactName"; this.cboName.DataBind(); } else //bind users by office instead { //Query _qry = new Query(Tables.EmployeesTable,"WWIprov").AddWhere("OfficeID", Comparison.Equals, _officeid).ORDER_BY("Name", "asc"); //EmployeesTableCollection _employee = new EmployeesTableCollection(); //_employee.LoadAndCloseReader(_qry.ExecuteReader()); //DataTable _dt = (DataTable)_employee.ToDataTable(); //this.cboName.DataSource = _dt; //this.cboName.ValueField = "EmployeeID"; //this.cboName.TextField = "Name"; //this.cboName.DataBind(); } //11/03/2011 append ALL USERS option as 1st item in dropdown //Code here to populate DropDownList DevExpress.Web.ASPxEditors.ListEditItem _li = new DevExpress.Web.ASPxEditors.ListEditItem("(All users)", "-1"); this.cboName.Items.Insert(0, _li); //default to all users this.cboName.SelectedIndex = 0; //250112 bind quick filter fields if user is logged in or not this.ObjectDataSourceFields.SelectMethod = "FetchByActive"; this.ObjectDataSourceFields.DataBind(); } else { //250112 bind quick filter fields if user is logged in or not this.ObjectDataSourceFields.SelectMethod = "FetchByActiveAnonymous"; this.ObjectDataSourceFields.DataBind(); } }