32CheckBox布局,字体替换--[Asp.Net]

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.UI;
        using System.Web.UI.WebControls;
        
        //包含demo
        namespace demo5
        {
            public partial class baohan2 : System.Web.UI.Page
            {
                protected void CheckBoxList1_DataBound(object sender, EventArgs e)
                {
                    int n = CheckBoxList1.Items.Count;
                    for (int i = 0; i < n; i++)
                    {
                        CheckBoxList1.Items[i].Text = CheckBoxList1.Items[i].Text;
                    }
                
                }
        
                protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
                {
                    int n = CheckBoxList1.Items.Count;
                    for (int i = 0; i < n; i++)
                    {
                        if(CheckBoxList1.Items[i].Selected )
                        {
                            string txt=  CheckBoxList1.Items[i].Text;
                            string t = txt.Replace ("你好","谢谢");
                            Response.Write(t);
        
                        }
                    }
                }
        
                protected void Button1_Click(object sender, EventArgs e)
                {
                    //如果当前排列是垂直排列
                    if (CheckBoxList1.RepeatDirection == RepeatDirection.Vertical)
                    {
                        Button1.Text = "垂直排列";
                        CheckBoxList1.RepeatDirection = RepeatDirection.Horizontal;
                    }
                    else
                    {
                        Button1.Text = "给我水平排列";
                        CheckBoxList1.RepeatDirection = RepeatDirection.Vertical;
                    }
                }
                
            }
        }

 

感受:

  这个可以用于评教里面,排列可以横排,可以竖排,选项,选中之后会有反应。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。