ASP.NETÖÐWebForm×é¼þCheckBoxList±à³Ì(4)
¡¶ASP.NETÖÐWebForm×é¼þCheckBoxList±à³Ì(4)¡·ÕªÒª£º Î壮 ÎÄÖÐÔ´³ÌÐò´úÂë(Check.aspx)ºÍÖ´ÐеĽçÃæ£º ÏÂͼÊÇÖ´ÐÐÁËÏÂÁÐÔ´³ÌÐò´úÂë(Check.aspx)ºó£¬Éú³ÉµÄ½çÃæ£º Check.aspxÔ´³ÌÐò´úÂëÈçÏÂ: £¼% @ Page Language = "C#" %£¾ £¼html £¾ £¼head £¾ £¡
¡¡¡¡ÏÂͼÊÇÖ´ÐÐÁËÏÂÁÐÔ´³ÌÐò´úÂë(Check.aspx)ºó£¬Éú³ÉµÄ½çÃæ£º
¡¡¡¡Check.aspxÔ´³ÌÐò´úÂëÈçÏÂ:
£¼% @ Page Language = "C#" %£¾
£¼html £¾
£¼head £¾
£¼title £¾ CheckBoxList×é¼þÑÝʾ³ÌÐò £¼/title £¾
£¼script runat = "server" £¾
¡¡protected void Button_Click ( object sender , EventArgs e )
¡¡{
¡¡¡¡//×é¼þÖеļì²é¿òÖеÄÎı¾ºÍÑ¡¿òµÄÅÅÁÐλÖÃ
¡¡¡¡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 )
¡¡¡¡{
¡¡¡¡}
¡¡¡¡lblResult . Text = "" ;
¡¡¡¡for ( int i = 0 ; i £¼ ChkList . Items . Count ; i )
¡¡¡¡{
¡¡¡¡¡¡if( ChkList . Items [ i ] . Selected )
¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡lblResult . Text = ChkList . Items [ i ] .Text " £¼br £¾ " ;
¡¡¡¡¡¡}
¡¡¡¡}
¡¡}
¡¡£¼/script £¾
¡¡£¼/head £¾
¡¡£¼body £¾
¡¡£¼form runat = "server" £¾
¡¡¡¡£¼h1 align = center £¾ CheckBoxList×é¼þÑÝʾ³ÌÐò £¼/h1 £¾
¡¡¡¡£¼table £¾
¡¡¡¡¡¡£¼tr £¾
¡¡¡¡¡¡¡¡£¼td £¾ ×é¼þÖеÄÎı¾ÅÅÁÐλÖ㺠£¼/td £¾
¡¡¡¡¡¡¡¡£¼td £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:DropDownList id = cboAlign runat = "server" £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ¾Ó×ó £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ¾ÓÓÒ £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼/asp:DropDownList £¾
¡¡¡¡¡¡¡¡£¼/td £¾
¡¡¡¡¡¡£¼/tr £¾
¡¡¡¡¡¡£¼tr £¾
¡¡¡¡¡¡¡¡£¼td £¾ ×é¼þÖи÷¸öÌõÄ¿²¼¾Ö£º £¼/td £¾
¡¡¡¡¡¡¡¡£¼td £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:DropDownList id = cboRepeatLayout runat = "server" £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ±í¸ñÐÍ £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ½ô´ÕÐÍ £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼/asp:DropDownList £¾
¡¡¡¡¡¡¡¡£¼/td £¾
¡¡¡¡¡¡£¼/tr £¾
¡¡¡¡¡¡£¼tr £¾
¡¡¡¡¡¡¡¡£¼td£¾ ×é¼þÖи÷¸öÌõÄ¿ÅÅÁз½Ïò£º£¼/td £¾
¡¡¡¡¡¡¡¡£¼td £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:DropDownList id = cboRepeatDirection runat = "server" £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ˮƽ·½Ïò £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¼asp:ListItem £¾ ´¹Ö±·½Ïò £¼/asp:ListItem £¾
¡¡¡¡¡¡¡¡¡¡¡¡£¼/asp:DropDownList £¾
¡¡¡¡¡¡¡¡£¼/td £¾
¡¡¡¡¡¡£¼/tr £¾
¡¡¡¡¡¡£¼tr £¾
¡¡¡¡¡¡¡¡£¼td £¾ ×é¼þÖи÷¸öÌõÄ¿ÅÅÁÐÐÐÊý£º £¼/td £¾
¡¡¡¡¡¡¡¡£¼td £¾ £¼asp:TextBox id = "txtRepeatCols" runat = "server" /£¾ £¼/td £¾
¡¡¡¡¡¡£¼/tr £¾
¡¡¡¡£¼/table £¾
¡¡¡¡£¼br £¾
¡¡¡¡¡¡ÇëÑ¡ÔñÄãËùÐèҪѧϰµÄ¼ÆËã»úÓïÑÔÀàÐÍ£º
¡¡¡¡£¼br £¾
¡¡¡¡£¼asp:CheckBoxList id = "ChkList" RepeatDirection = Horizontal runat = "server" £¾
¡¡¡¡¡¡£¼asp:ListItem £¾ Visual C .Net £¼/asp:ListItem £¾
¡¡¡¡¡¡£¼asp:ListItem £¾ Visual C# £¼/asp:ListItem £¾
¡¡¡¡¡¡£¼asp:ListItem £¾ VB.NET £¼/asp:ListItem £¾
¡¡¡¡¡¡£¼asp:ListItem £¾ JScript.NET £¼/asp:ListItem £¾
¡¡¡¡¡¡£¼asp:ListItem £¾ Visual J# £¼/asp:ListItem £¾
¡¡¡¡£¼/asp:CheckBoxList £¾
¡¡¡¡£¼br £¾
¡¡¡¡¡¡£¼asp:Button Text = "Ìá½»" runat = "server" onclick = "Button_Click" /£¾
¡¡¡¡¡¡£¼h1 £¾ £¼font color = red £¾ ÄãÑ¡ÔñµÄ¼ÆËã»úÓïÑÔÀàÐÍΪ£º £¼/font £¾ £¼/h1 £¾
¡¡¡¡¡¡£¼asp:Label id = lblResult runat = "server" /£¾
¡¡£¼/form £¾
¡¡£¼/body £¾
£¼/html £¾
¡¡¡¡Áù£® ×ܽ᣺
¡¡¡¡ÆäʵCheckBoxList×é¼þÒ²ÊÇÒ»¸ö·þÎñÆ÷¶Ë×é¼þ¡£±¾ÎĽéÉÜÁËCheckBoxList×é¼þÖеÄһЩÖ÷ÒªµÄÊôÐԺͷ½·¨£¬²¢ÇÒͨ¹ýÒ»¸ö±È½ÏµäÐ͵ÄÀý×Ó˵Ã÷ÁËÔÚASP.NETÒ³ÃæÖÐÈçºÎ½øÐÐÓëCheckBoxList×é¼þÏà¹ØµÄ±à³Ì£¬Æäʵ¶ÔÓÚÁíÍâÒ»¸ö±È½ÏÖØÒªµÄ×é¼þ--CheckBoxÀ´Ëµ£¬ËûÃÇÖÐÓÐÐí¶àµÄÏàËÆÖ®´¦£¬°ÑÎÕÁËCheckBoxList×é¼þµÄÓ÷¨´óÖÂÒ²¾Í°ÑÎÕÁËCheckBox×é¼þµÄÓ÷¨¡£
ÉÏһƪ£ºADO.NETÈëÃÅ(1) ÏÂһƪ£ºASP.NETÖÐWebForm×é¼þCheckBoxList±à³Ì(3)
Ó²¼þ¹ÊÕÏרÌâ
¸ü¶àÈí¼þ¹ÊÕÏάÐÞ
¸ü¶àÔĶÁÅÅÐÐ
- Ç×ÃܽӴ¥ASP.Net(8) DataSet
- asp Óï·¨½Ì³Ì(Áù)Êý¾Ý¿âƪ
- Ç×ÃܽӴ¥ASP.Net(5) DataBindÊý¾ÝºËÐÄ
- Ç×ÃܽӴ¥ASP.Net(4) WEB¿Ø¼þ
- ASP.NETÖÐWebForm×é¼þCheckBoxList±à³Ì
- .NETÖ®ASP Web Application¿ìËÙÈëÃÅ(3)
- Ç×ÃܽӴ¥ASP.Net(15) ״̬±£´æ
- ASPÊ®²½½ø½×
- Ç×ÃܽӴ¥ASP.Net(3) asp ÖеĿؼþ
- asp.NETÌØÐ´
- ´ÓASPÇ¨ÒÆÖÁASP --½øÈëDataSet
- ADO.NETÈëÃÅ(3)
