|
|
| ASP.NET中WebForm组件CheckBoxList编程(3) |
| 作者:不详 来源:不详 发布时间:2006-8-14 10:03:00 发布人:chinazhan |
减小字体
增大字体
四. 实例介绍CheckBoxList组件的使用方法: (1).如何判定选择了组件中的哪些检查框: 在程序中,是通过处理Selected属性和Count属性来完成的,具体如下: for ( int i = 0 ; i < ChkList . Items . Count ; i++ ) { if( ChkList . Items [ i ] . Selected ) { lblResult . Text += ChkList . Items [ i ] .Text + " <br > " ; } } (2).如何设定CheckBoxList组件的外观布局: CheckBoxList组件有比较多的属性来设定它的外观,在本文介绍的程序中,主要是通过四个方面来设定组件的外观布局的:组件中的检查框中的文本和选框的排列位置、组件中各个检查框布局、组件中各个检查框排列方向和组件中各个检查框的排列行数,具体的程序代码如下: //组件中的检查框中的文本和选框的排列位置 switch ( cboAlign . SelectedIndex ) { case 0 : ChkList . TextAlign = TextAlign . Left ; break ; case 1 : ChkList . TextAlign = TextAlign . Right ; break ; } //组件中各个检查框布局 switch ( cboRepeatLayout . SelectedIndex ) { case 0 : ChkList . RepeatLayout = RepeatLayout . Table ; break ; case 1 : ChkList . RepeatLayout = RepeatLayout . Flow ; break ; } //组件中各个检查框排列方向 switch ( cboRepeatDirection . SelectedIndex) { case 0 : ChkList . RepeatDirection = RepeatDirection . Vertical ; break ; case 1 : ChkList . RepeatDirection = RepeatDirection . Horizontal ; break ; } //组件中各个检查框的排列行数 try { int cols = int . Parse ( txtRepeatCols.Text ) ; ChkList . RepeatColumns = cols ; } catch ( Exception ) { } 做人要厚道,请注明转自chinazhan中国站长(www.ChinaZhan.com)。
|
| |
|
[]
[返回上一页]
[打 印]
[收 藏] |
|
| ∷相关文章评论∷ (评论内容只代表网友观点,与本站立场无关!) [更多评论...] |
|
|