首页 > 代码库 > 绑定下拉框

绑定下拉框

 public void DropDownListBinding(DropDownList DDList, string sql, string strText, string strField, string str_qxz)    {        DataTable dt = MDGL.DBUtility.SQLServerHelper.GetDataTable(CommandType.Text, sql);        DDList.DataSource = dt;        DDList.DataValueField = strField;        DDList.DataTextField = strText;        DDList.DataBind();        ListItem NewItem = new ListItem();        NewItem.Value = "";        NewItem.Text = str_qxz;        DDList.Items.Insert(0, NewItem);    }