显示列表

dropDownList.DataSource = dataSet.Tables[0].DefaultView;
dropDownList.DataTextField = "Name";
dropDownList.DataValueField = "ID";
dropDownList.DataBind();
dropDownList.Items.Insert(0,new ListItem("选择选择",""));


dropDownList.Text:获取或设置 ListControl 控件的 SelectedValue 属性
dropDownList.SelectedValue:获取列表控件中选定项的值,或选择列表控件中包含指定值的项。 
dropDownList.SelectedItem.Text:获取选定项的文本值



<asp:DropDownList ID="dropDownList" runat="server">
    <asp:ListItem>大陆</asp:ListItem>
    <asp:ListItem>港台</asp:ListItem>
    <asp:ListItem>日本</asp:ListItem>
    <asp:ListItem>韩国</asp:ListItem>
    <asp:ListItem>欧洲</asp:ListItem>
    <asp:ListItem>美国</asp:ListItem>
    <asp:ListItem>其它</asp:ListItem>
</asp:DropDownList>

标签:控件 
返回摘要 | 分类(Asp.Net) | 访问(82) | 编辑