ASP.NET 4.0 New Feature : 表单控制项之延伸RepeatLayout功能

 


文章来自: IT工程技术网 http://www.systhinker.com/html/36/n-11536.html

CheckBoxList 和RadioButtonList这两个清单控制项,在ASP.NET 4.0中的RepeatLayout属性有做了延伸性的功能加强,在以往的ASP.NET 3.5版本中,RepeatLayout属性只有两个选择可以设定,分别为: Table和Flow。

如果这个属性设定为RepeatLayout.Table,则清单中的项目会显示在资料表,如果这个属性设定为RepeatLayout.Flow,则清单中的项目不显示资料表结构。

例如假设我们把控制项设定为以下设定:

<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatLayout="Flow">

<asp:ListItem Text="CheckBoxList" Value="cbl" />

</asp:CheckBoxList>

 

<asp:RadioButtonList runat="server" RepeatLayout="Table">

<asp:ListItem Text="RadioButtonList" Value="rbl" />

</asp:RadioButtonList>

那么浏览网页后所得到的HTML将分别转译为sapn和table为:

< span id="CheckBoxList1"> <input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" />

<label for="CheckBoxList1_0">CheckBoxList</label>

</span>

 

< table id="RadioButtonList1" border="0">

<tr>

<td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1"

value="rbl" />

<label for="RadioButtonList1_0">RadioButtonList</label> </td>

</tr>

</table>

那么ASP.NET 4.0又多了另外两个选择设定,分别为:OrderedList 和UnorderedList,如果这个属性设定为RepeatLayout. OrderedList,则清单中的项目会显示使用ol搭配li设定显示,如果这个属性设定为RepeatLayout . UnorderedList,则清单中的项目会显示使用ul搭配li设定显示。

以下假设针对CheckBoxList分别设定RepeatLayout. OrderedList和RepeatLayout. UnorderedList,我们来看看所呈现不同的结果,首先当设定为OrderedList,则如下图所示,会有顺序性的排序编号资料:

如果是设定为UnorderedList,则会呈下如下图所示,并不会有顺序编号,但是会用条列重点方式:

这里要特别注意一点,假设你设定RepeatLayout为OrderedList 或是UnorderedList,那么另一个属性RepeatDirection就不能设定修改为Horizontal,否则将会出现设计上的错误,预设只能搭配Vertical。

文章来自: IT工程技术网 http://www.systhinker.com/html/36/n-11536.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值