ASP.NET移动开发之SelectionList控件_.net资料_编程技术-你的首页-uuhomepage.com
正如前面提及的那样,SelectionList控件适用于呈现较短列表的数据项。尽管它不具备对长列表的分页显示功能,但是它的呈现形式是丰富多样的。只要设备浏览器支持,SelectionList控件可以以下拉列表、单项按钮、多选按钮和复选框等众多形式存在。
SelectionList控件的列表中只有一个可视的数据项,其它的数据项只能以隐藏值的形式与可视的数据项进行关联。要在服务器控件语法中指定隐藏值,可以在<Item>元素中使用Value属性,并且将Value属性指定某数据项即可。如果使用动态绑定的形式来构建列表的话,那么你可以使用DataValueField属性指定数据源中的某个字段作为隐藏值。
语法 SelectionList列表控件的语法如下面的清单所示:
<mobile:SelectionList
runat="server"
id="id"
Alignment="{NotSet|Left|Center|Right}"
BackColor="backgroundColor"
BreakAfter="{True|False}"
Font-Bold="{NotSet|False|True}"
Font-Italic="{NotSet|False|True}"
Font-Name="fontName"
Font-Size="{NotSet|Normal|Small|Large}"
ForeColor="foregroundColor"
StyleReference="StyleReference"
Wrapping="{NotSet|Wrap|NoWrap}"
DataMember="dataMember"
DataSource="dataSource"
DataTextField="DataTextField"
DataValueField="DataValueField"
SelectType="{DropDown|ListBox|Radio|MultiSelectListBox|CheckBox}"
Title="String"
OnItemDataBind="itemDataBindHandler"
OnSelectedIndexChanged="selectedIndexChangedHandler">
<!-- 可选,以静态的方式声明数据项-->
<Item Text="Text" Value="Value" Selected="{True|False}"/>
</mobile:SelectionList>