ASP.NET Mobile SelectionList Control[转]

Definition and Usage
定义和用法

The SelectionList control is used to create a list on a mobile device.
SelectionList 控件的作用是:在一个移动设备上创建一张列表。

Differences between a SelectionList control and a List control:
SelectionList 控件和 List 控件之间的不同点:

  • A SelectionList control supports multiple item selections and the List control only supports single item selections
    SelectionList 控件支持多个选项,而List 控件只支持单个选项。
  • A SelectionList control supports drop-down lists, combo boxes, and radio buttons and the List control only supports common lists
    SelectionList 空间支持下拉列表、复选框和多项选择按钮,而List 控件只支持普通列表。
  • An item selected from a SelectionList control does not generate a server event
    SelectionList 控件的项目选项不能产生服务器事件。
  • A SelectionList control does not offer pagination
    SelectionList 控件不能支持“分页”功能

Properties
属性

Property
属性
Value
Description
描述
Alignment left
center
right
Optional. How to align the list
可选参数。定义列表的对齐方式
BackColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A background color for the list
可选参数。定义列表的背景颜色
DataMember dataMember Optional. Specifies the data member to extract in data binding to a data source
可选参数。指定提取的数据成员(该数据是绑定到数据源的)
DataTextField dataTextField Optional.
可选参数
DataValueField dataValueField Optional.
可选参数
ForeColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A foreground color for the list
可选参数。指定列表的前景颜色
Font-Bold false
true
Optional. Specifies whether or not the text in the list should be bold
可选参数。指定列表文本中的字体是否以粗体显示
Font-Italic false
true
Optional. Specifies whether or not the text in the list should be italic
可选参数。指定列表文本中的字体是否以斜体显示
Font-Name fontname Optional. Specifies the font name of the text in the list
可选参数。指定列表文本中的字体名称
Font-Size normal
small
large
Optional. Specifies the font size of the text in the list
可选参数。指定列表文本中的字体尺寸
id unique_name Optional. A unique id for the control
可选参数。为控件指定一个独立的id
OnItemDataBind function_name Optional. The name of the function to be executed when an item is data bound to a MobileListItem object
可选参数。当一个项是绑定到一个MobileListItem 对象的数据时,指定需要执行的函数
 
OnSelectedIndexChanged function_name Optional. The name of the function to be executed when the index of the selected item has changed
可选参数。当已选项的索引数被改变时,执行的函数名称
Rows rows Optional. Specifies the number of rows to display. Default is "4"
可选参数。指定显示的行数。默认值为“4”
runat "server" Required. Specifies that the control is a server control
必要参数。指定该控件为服务器控件
SelectType DropDown
ListBox
Radio
MultiSelectListBox
CheckBox
Optional. Specifies the type of list to display. "DropDown" is default.
可选参数。指定显示的列表样式。默认为“DropDown[下拉菜单]”
StyleReference name_of_style_element Optional. Specifies a reference to a style to be applied to the control
可选参数。指定一个应用于控件的样式参数
Title text Optional. Specifies a title to display. Only for WML devices
可选参数。指定显示的标题。仅支持WML设备
Wrapping wrap
nowrap
Optional. Specifies whether or not the text in the list should wrap
可选参数。指定列表中的文本是否可以被嵌套

Example 1

The following example is an .aspx page with two forms. The first form has a list of cars. The second form is activated when a car is selected in the first form, and it displays the price of the selected car:
下面这个案例包含一个位于.aspx文件中的两张表单。第一张表单是一个汽车列表;当在第一张表单种选择具体的汽车时,第二张表单将被激活,并显示所选车型所对应的价格:

<%@ Page
Inherits="System.Web.UI.MobileControls.MobilePage"%>
<%@ Register TagPrefix="Mobile"
Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<script runat="server">

Sub Car_Click(sender as Object, e as EventArgs)
ActiveForm=f2
t1.text=cars.Selection.Value
End Sub
</script>
<Mobile:Form id="f1" runat="server">
<Mobile:SelectionList runat="server" id="cars" >

<Item Text="Volvo" Value="$30,000" />
<Item Text="BMW" Value="$32,000" />

<Item Text="Audi" Value="$34,000" />
</Mobile:SelectionList>
<Mobile:Command runat="server"
OnClick="Car_Click" Text="Submit" />

</Mobile:Form>
<Mobile:Form id="f2" runat="server">
<Mobile:Label id="t1" runat="server" />

</Mobile:Form>

When this page is displayed on a mobile device, the navigation and display functions of the page will be compiled differently for different devices with different display characteristics.
当该页面在移动设备上显示时,页面的导航系统和显示函数将支持不同的设备,并且将使用不同的显示特征。

For some devices, like a handheld PC, it might display a dropdown list to choose from. For a cell phone it might display a list of options to select from.
对于像掌上电脑这样的设备来说,如果选择了表单后,它可能会显示下拉列表。对于一个手机来说,它可能会显示选项表单的选项列表。

posted on 2009-03-17 17:12  黄裳  阅读(402)  评论(0编辑  收藏  举报

导航