private void performSelectionDataBinding() { ConnectStr = (new igFunctions.DB().getConStr()); SqlConnection Con = new SqlConnection(ConnectStr); SqlCommand cmdCustomer = new SqlCommand(@" SELECT org_account_number, CASE WHEN isnull(class_code,'') = '' THEN dba_name ELSE dba_name + '[' + RTRIM(LTRIM(isnull(class_code,''))) + ']' END as dba_name FROM organization WHERE elt_account_number = " + elt_account_number + " AND (dba_name!='') order by dba_name", Con); SqlDataAdapter Adap = new SqlDataAdapter(); DataSet tmpDs = new DataSet(); Con.Open(); Adap.SelectCommand = cmdCustomer; Adap.Fill(tmpDs, "Customer"); Con.Close(); ComboBox1.DataSource = tmpDs.Tables["Customer"]; ComboBox1.DataTextField = tmpDs.Tables["Customer"].Columns["dba_name"].ToString(); ComboBox1.DataValueField = tmpDs.Tables["Customer"].Columns["org_account_number"].ToString(); ComboBox1.DataBind(); // ComboBox1.Items.Insert(0,""); // ComboBox1.SelectedIndex = 0; }
private void show_category() { if (User.Identity.IsAuthenticated) { SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000); SqlDataReader dr1000; con1000.Open(); dr1000 = cmd1000.ExecuteReader(); if (dr1000.Read()) { company_id = Convert.ToInt32(dr1000["com_id"].ToString()); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd = new SqlCommand("Select * from party where Com_Id='" + company_id + "' and category='Supplier' ORDER BY party_id asc", con); con.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); ComboBox1.DataSource = ds; ComboBox1.DataTextField = "party_name"; ComboBox1.DataValueField = "party_id"; ComboBox1.DataBind(); ComboBox1.Items.Insert(0, new ListItem("Select party", "1")); con.Close(); } con1000.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ComboBox1.DataSource = OrdersData.GetOrders(); ComboBox1.DataBind(); } }
protected void ConfigureHeaderTemplates() { ComboBox1.HeaderTemplate = new HeaderTemplate("CUSTOMERS"); ComboBox2.HeaderTemplate = new HeaderTemplate((ComboBox1.SelectedText != String.Empty ? ComboBox1.SelectedText : "")); ComboBox3.HeaderTemplate = new HeaderTemplate((ComboBox2.SelectedText != String.Empty ? "Order #" + ComboBox2.SelectedText : "")); ComboBox1.DataBind(); ComboBox2.DataBind(); ComboBox3.DataBind(); }
private void ComboTipo() { string cadena = "SELECT * FROM TIPO_PRODUCTO"; OracleCommand comando = new OracleCommand(cadena, ora); OracleDataAdapter adaptador = new OracleDataAdapter(comando); DataTable tabla = new DataTable(); adaptador.Fill(tabla); ComboBox1.DataSource = tabla; ComboBox1.DataTextField = "TIPO"; ComboBox1.DataValueField = "ID_T_PRO"; ComboBox1.DataBind(); }
//绑定项目ID private void comboBoxData() { sqlText = "select distinct TSA_PJID, TSA_PJNAME from TBPM_TCTSASSGN "; sqlText += "where TSA_TCCLERK='" + Session["UserID"] + "' "; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqlText); ComboBox1.DataSource = dt; ComboBox1.DataTextField = "TSA_PJID"; ComboBox1.DataValueField = "TSA_PJNAME"; ComboBox1.DataBind(); ComboBox1.Items.Insert(0, new ListItem("全部", "0")); ComboBox1.SelectedIndex = 0; }
private void ComboImp() { string cadena = "SELECT * FROM IMPORTACION"; OracleCommand comando = new OracleCommand(cadena, ora); OracleDataAdapter adaptador = new OracleDataAdapter(comando); DataTable tabla = new DataTable(); adaptador.Fill(tabla); ComboBox1.DataSource = tabla; ComboBox1.DataTextField = "NOMBRE_C"; ComboBox1.DataValueField = "ID_IMP"; ComboBox1.DataBind(); }
private void Combo2() { string cadena = "SELECT * FROM CONTRIBUYENTE"; OracleCommand comando = new OracleCommand(cadena, ora); OracleDataAdapter adaptador = new OracleDataAdapter(comando); DataTable tabla = new DataTable(); adaptador.Fill(tabla); //ddlcont.DataSource = Consultar("SELECT * FROM CONTRIBUYENTE"); ComboBox1.DataSource = tabla; ComboBox1.DataTextField = "NOMBRE_CONT"; ComboBox1.DataValueField = "ID_CONT"; ComboBox1.DataBind(); }
//初始化绑定工程 private void comboBoxEng() { sqlText = "select distinct DCS_ENGID, DCS_ENGID+'‖' +DCS_ENGNAME as DCS_ENGNAME "; sqlText += "from TBPM_DEPCONSHEET where DCS_DEPID in ('03','01') "; sqlText += "and DCS_PROJECTID='" + ComboBox2.SelectedValue + "' "; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqlText); ComboBox1.DataSource = dt; ComboBox1.DataTextField = "DCS_ENGNAME"; ComboBox1.DataValueField = "DCS_ENGID"; ComboBox1.DataBind(); ComboBox1.Items.Insert(0, new ListItem("全部", "0")); ComboBox1.SelectedIndex = 0; }
// Handles the "LoadingItems" event of the ComboBox protected void ComboBox1_LoadingItems(object sender, ComboBoxLoadingItemsEventArgs e) { // Getting the items DataTable data = GetItems(e.Text, e.ItemsOffset, 10); ComboBox1.DataSource = data; ComboBox1.DataBind(); // Calculating the numbr of items loaded so far in the ComboBox e.ItemsLoadedCount = e.ItemsOffset + data.Rows.Count; // Getting the total number of items that start with the typed text e.ItemsCount = GetItemsCount(e.Text); }
void comboBoxData() { string sql = "select distinct PT_PJNAME from TBMP_PRDCTTASKTOTAL";//从任务单管理中读取所有的项目名称 DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); if (dt.Rows.Count > 0) { ComboBox1.DataSource = dt; ComboBox1.DataTextField = "PT_PJNAME"; ComboBox1.DataValueField = "PT_PJNAME"; ComboBox1.DataBind(); } ComboBox1.Items.Insert(0, new ListItem("-全部-", "")); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize property-changers if (!IsPostBack) { ComboBox1.DataSource = GetWordListText(); ComboBox1.DataBind(); AutoPostBackCheckBox.Checked = (ComboBox1.AutoPostBack) ? true : false; DropDownStyleRadioButtonList.SelectedValue = ComboBox1.DropDownStyle.ToString(); AutoCompleteModeRadioButtonList.SelectedValue = ComboBox1.AutoCompleteMode.ToString(); CaseSensitiveCheckBox.Checked = (ComboBox1.CaseSensitive) ? true : false; CssClassRadioButtonList.SelectedValue = ComboBox1.CssClass; ItemInsertLocationRadioButtonList.SelectedValue = ComboBox1.ItemInsertLocation.ToString(); } }
private void performSelectionDataBinding() { ConnectStr = (new igFunctions.DB().getConStr()); SqlConnection Con = new SqlConnection(ConnectStr); SqlCommand cmdCustomer = new SqlCommand(@" SELECT userid,login_name FROM users WHERE elt_account_number = " + elt_account_number + " order by login_name", Con); SqlDataAdapter Adap = new SqlDataAdapter(); DataSet tmpDs = new DataSet(); Con.Open(); Adap.SelectCommand = cmdCustomer; Adap.Fill(tmpDs, "Users"); Con.Close(); ComboBox1.DataSource = tmpDs.Tables["Users"]; ComboBox1.DataTextField = tmpDs.Tables["Users"].Columns["login_name"].ToString(); ComboBox1.DataValueField = tmpDs.Tables["Users"].Columns["userid"].ToString(); ComboBox1.DataBind(); DropDownList2.DataSource = tmpDs.Tables["Users"]; DropDownList2.DataTextField = tmpDs.Tables["Users"].Columns["login_name"].ToString(); DropDownList2.DataValueField = tmpDs.Tables["Users"].Columns["userid"].ToString(); DropDownList2.DataBind(); DropDownList2.Items.Insert(0, " "); DropDownList2.SelectedIndex = 0; for (int i = 0; i < 7; i++) { DropDownList1.Items.Add(""); } DropDownList1.Items[0].Value = "0"; DropDownList1.Items[0].Text = " "; DropDownList1.Items[1].Value = "1"; DropDownList1.Items[1].Text = "Customer"; DropDownList1.Items[2].Value = "2"; DropDownList1.Items[2].Text = "Agent"; DropDownList1.Items[3].Value = "3"; DropDownList1.Items[3].Text = "Operation"; DropDownList1.Items[4].Value = "4"; DropDownList1.Items[4].Text = "Accounting"; DropDownList1.Items[5].Value = "5"; DropDownList1.Items[5].Text = "Site Administrator"; DropDownList1.Items[6].Value = "6"; DropDownList1.Items[6].Text = "Super User"; }
private void BindData() { var folder = Server.MapPath("~/explore/css/images/icons/32"); DirectoryInfo di = new DirectoryInfo(folder); FileInfo[] files = di.GetFiles(); List <ImageItem> items = new List <ImageItem>(); string basePath = this.Page.ResolveUrl("~/explore/css/images/icons/32"); foreach (FileInfo fi in files) { items.Add(new ImageItem(fi.Name, basePath + "/" + fi.Name)); } ComboBox1.DataSource = items; ComboBox1.DataTextField = "Name"; ComboBox1.DataValueField = "Name"; ComboBox1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { if (ComboBox1.SelectedIndex == -1 && ComboBox1.SelectedText != ComboBox1.EmptyText) { OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../App_Data/continent.mdb")); myConn.Open(); OleDbCommand myComm = new OleDbCommand("INSERT INTO Country (CountryName) VALUES(@CountryName)", myConn); myComm.Parameters.Add("@CompanyName", OleDbType.VarChar).Value = ComboBox1.SelectedText; myComm.ExecuteNonQuery(); myConn.Close(); ComboBox1.Items.Clear(); ComboBox1.SelectedIndex = 0; ComboBox1.DataBind(); } }
void comboBoxData() { DataTable dt = new DataTable(); dt.Columns.Add("PT_PJID"); dt.Columns.Add("PT_PJNAME"); dt.Rows.Add("全部", "0"); string sql = "select PJ_ID, PJ_NAME from TBPM_PJINFO";//读取所有的项目名称 SqlDataReader dr1 = DBCallCommon.GetDRUsingSqlText(sql); while (dr1.Read()) { DataRow dr = dt.NewRow(); dr[0] = dr1["PJ_ID"].ToString(); dr[1] = dr1["PJ_NAME"].ToString(); dt.Rows.Add(dr); } dr1.Close(); ComboBox1.DataSource = dt; ComboBox1.DataTextField = "PT_PJID"; ComboBox1.DataValueField = "PT_PJNAME"; ComboBox1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { ComboBox1.DataBind(); GridView1.DataBind(); }