SortedList 百科内容来自于: 百度百科

n

成员
SortedList 构造函数 (泛型 IDict... ... SortedList 泛型类 SortedList 成员
双语例句
SortedList Represents a selectable UI object that displays a sorted list of textitems.
SortedList表示一个可选择的 UI对象用于按顺序显示一个文本项目列表
SortedList Represents a selectable UI object that displays a sorted list of textitems.
SortedList表示一个可选择的 UI 对象用于按顺序显示一个文本项目列表
Create two manifestation relationships from the above artifact to the List and SortedList classes from the logical design model.
在逻辑设计模型中在以上标志和类 List 和 SortedList之间创建两个声明关系
Procedures for the use of documents to read and write, regular expressions, as well as technologies such as SortedList prepared containers.
程序使用文件读写正则表达式以及SortedList类容器等技术编写

SortedList 对象

简介

SortedList 对象包含用键/值对表示的项目SortedList 对象可按照字符顺序或数字顺序自动地对项目进行排序
通过 Add() 方法向 SortedList 添加项目SortedList 可通过 TrimToSize() 方法调整为最终尺寸

案例

<script runat="server">
sub Page_Load if Not Page.IsPostBack then
dim mycountries=New SortedList mycountries.Add("C","China")
mycountries.Add("S","Sweden")
mycountries.Add("F","France")
mycountries.Add("I","Italy")
end if end sub
</script>

数据绑定

SortedList 对象可自动地为下面的控件生成文本和值
asp:RadioButtonList
asp:CheckBoxList
asp:DropDownList
asp:Listbox
如需把数据绑定到 RadioButtonList 控件首先请在 aspx 文件中创建一个 RadioButtonList 控件没有任何 asp:ListItem 元素
<html> <body>
<form runat="server">
<asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" />
</form>
</body>
</html>
然后添加构建列表的脚本
<script runat="server"> sub Page_Load if Not Page.IsPostBack then dim
mycountries=New SortedList mycountries.Add("C","China")
mycountries.Add("S","Sweden")
mycountries.Add("F","France")
mycountries.Add("I","Italy") rb.DataSource=mycountries
rb.DataValueField="Key"
rb.DataTextField="Value"
rb.DataBind()
end if end sub
</script>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" />
</form>
</body>
</html>
然后我们添加一个子例程该子例程会在用户点击 RadioButtonList 控件中的项目时执行当单选按钮被点击时文本将出现在 label 中
<script runat="server"> sub Page_Load if Not Page.IsPostBack then
dim mycountries=New SortedList mycountries.Add("C","China")
mycountries.Add("S","Sweden") mycountries.Add("F","France")
mycountries.Add("I","Italy") rb.DataSource=mycountries rb.DataValueField="Key" rb.DataTextField="Value" rb.DataBind()
end if end sub
sub displayMessage(s as Object,e As EventArgs)
lbl1.text="Your favorite country is: " & rb.SelectedItem.Text end sub</script>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="rb" runat="server" AutoPostBack="True"onSelectedIndexChanged="displayMessage" />
<p>
<asp:label id="lbl1" runat="server" />
</p>
</form>
</body>
</html>
$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定