今天才摸到dropdownlist的一些皮毛.
以前总是想着怎么在dropdownlist里显示的是其值,而传递的是编号.
唉,原来就这么简单:
sql
=
"
select PhotoClassId,photoClassName from photoClass
"
;
ds = GD.DataBind(sql);
// 绑定文本
this .DropDownList3.DataTextField = " photoClassName " ;
// 绑定编号
this .DropDownList3.DataValueField = " PhotoClassId " ;
this .DropDownList3.DataSource = ds;
this .DropDownList3.DataBind();
ds = GD.DataBind(sql);
// 绑定文本
this .DropDownList3.DataTextField = " photoClassName " ;
// 绑定编号
this .DropDownList3.DataValueField = " PhotoClassId " ;
this .DropDownList3.DataSource = ds;
this .DropDownList3.DataBind();