由于每一个RadioButton Web 控件是独立的控件,若要判断同一个群组内的RadioButton 是否被选择,则必须判断所有的RadioButton Web 控件的Checked 属性,这样判断实在是很没效率。所以微软便制作了RadioButtonList Web 控件,这个RadioButtonList 控件可以管理许多选项,其使用语法如下:
<ASP:RadioButtonList Id="被程序代码所控制的名称" Runat="Server" AutoPostBack="True | False" CellPadding="像素" *DataSource="<%数据系结叙述%>" *DataTextField="数据源的字段" *DataValueField="数据源的字段" RepeatColumns="字段数量" RepeatDirection="Vertical | Horizontal" RepeatLayout="Flow | Table" TextAlign="Right | Left" OnSelectedIndexChanged="事件程序名称" > <ASP:ListItem/> </ASP:RadioButtonList> *关于和数据源的数据系结部分,我们在后面的章节再介绍。
RadioButtonList Web 控件的属性和RadioButton Web 控件并不太相同,下表为RadioButtonListWeb 控件的常用属性:
RadioButtonList Web 控件的使用方法和HTML 控件的Select 控件很像,只要先安置好RadioButtonList Web 控件,接着设定它的子对象ListItem Web 控件即可产生一组群组好的RadioButton Web 控件。我们先来介绍ListItem Web 控件:
|