码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-05-09 21:45:44      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

        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;
                    }
                }
                
            }
        }

 

感受:

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

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

标签:

原文地址:http://www.cnblogs.com/wangmei/p/4491151.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!