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>

posted @ 2011-04-19 09:16  hen  阅读(239)  评论(0编辑  收藏  举报