DropDownList 下拉菜单控件
<asp:DropDownList ID="DropDownList_spec" runat="server" >
</asp:DropDownList>
数据绑定:
DataTable dt = c_pub.GetSqlTable(strSQL); DropDownList_spec.DataSource = dt; DropDownList_spec.DataTextField = "StyleName"; DropDownList_spec.DataValueField = "StyleId"; DropDownList_spec.DataBind();
DataTextField是给用户看的
DataValueField谁给自己用的
<option value=DataValueField>DataTextField</option>