更新时间:2022-05-30 02:48:04
希望它能起作用.....
dropdownlist1.datavaluefield.text
dopdownlist1.datatextfield.text
hope it works.....
dropdownlist1.datavaluefield.text
dopdownlist1.datatextfield.text
填充数据表中的数据.然后将此数据表保留到DropDownList.
Fill the the data''s in DataTable. Then assisgn this DataTable to the DropDownList.
ddl.DataSource = dataTable
ddl.DataValueField = "value field name"
ddl.DataTextField = "textfield name"
dd.DataBind()
OleDbConnection con = new OleDbConnection(connection);
DataSet ds = new DataSet();
OleDbDataAdapter ad = new OleDbDataAdapter("select Tittle from smsstorage order by Tittle Asc", con);
ad.Fill(ds);
//ddlsmsstorage.Items.Clear();
ddlsmsstorage.Items.Add("---Select---");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ddlsmsstorage.Items.Add(ds.Tables[0].Rows[i][0].ToString());
}
这样我们也可以添加您想要的字段..........
like this also we can add which field you want.............