RSS
热门关键字:  下载  cms  模版  开源  dedecms
当前位置 :| 主页 > 站长学院 > Asp.Net教程 >

通过事例学习.net的WebForms技术(三)

来源:不详 作者:未知 时间:2006-07-28 Tag: 点击:
DropDownList:
DropDownList 对应的Form 元素中的 <select ..> 我们同样对他的定义有两种方式
<asp:DropDownList id="dropdownlist1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:DropDownList>
代码定义方式:
DropDownList dropdownlist1=new DropDownList();

 

比较关键的用到了属性主要是:
SelectedItem 这个属性是一个ListItem Class 我们紧接着就来讲解这个ListItem 属性

ListItem 属性,

由于我们对于DropDownList 最为关心的就是我们在对DropDownList进行选择以后我们得到的结果
所以,我们对ListItem 的最为关心的属性自然就是Text和 Value 这两个属性
Text 是ListItem 在外表所显示出来的结果
Value 是我们所选择的 Item 的真正的数值

综上,我们总结一下DropDownList 的 SelectedItem 属性的使用方法
dropdownlist1.SelectedItem.Text 和 dropdownlist1.SelectedItem.Value



最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
热点关注
相关文章