DORPDOWNLIST绑定两个字段!对应的用户ID和用户名!
用什么方法啊
显示
id--username
用Intersoft WebCombo.NET控件,支持下拉datagrid,或绑定时生成用户ID和用户名的连接串
如生成这样的字符串数串,再绑定到dropdownlist
"0001 张三","0002 李四",...........
DropDownList1.DataSource=dataset;
DropDownList1.DataTextField="字段1";
DropDownList1.DataValueField="字段2";
DropDownList1.DataBind();
在sql中处理
select id+username as name from table
在绑定dropdownlist的textfield 为name
sql = "select id,username from table ";
dataset = 根据SQL求取数据集;
//绑定数据
DropDownList1.DataSource=dataset;
DropDownList1.DataTextField="id";
DropDownList1.DataValueField="username";
DropDownList1.DataBind();
如上所示,就是一个完整的绑定。