zoukankan      html  css  js  c++  java
  • Table 控件使用示例

     protected void Table_Create()
            {
                //------------------------------------------------------------------
                TableRow tr;  //定义的表格的行
                TableCell tc; //定义表格的列
                int TrNum = 15; //行数
                int TcNum = 5;//列数
                Literal Lie1;
                for (int n = 0; n < TrNum;n++ )
                {
                    tr = new TableRow();
                    for (int v = 0; v < TcNum;)
                    {
                        tc = new TableCell();
                        Lie1 = new Literal();
                        tc.Width = Unit.Pixel(50);
                        Lie1.Text = "行" + n + "列" + v;
                        tc.Controls.Add(Lie1);
                        //tc.Controls.Add(new LiteralControl("行" + n + "列" + v));
                        tc.HorizontalAlign = HorizontalAlign.Center;
                        if(v%2==0)
                        {
                            tc.BackColor = Color.HotPink;
                        }
                        else
                        {
                            tc.BackColor = Color.Green;
                        }
                        tr.Cells.Add(tc);
                        tc.Attributes.Add("onclick", "alert('第" + n + "行" + ",第" + v + "列');");
                        v++;
                    }
                    Table2.Rows.Add(tr);
                    if(n%2==0)
                    {
                        tr.Attributes.Add("style", "page-break-after:always;BackColor:Back;");
                    }
                }
               
                Table2.Width = Unit.Pixel(560);
                Table2.BorderWidth = Unit.Pixel(1);
                Table2.BorderStyle = BorderStyle.Ridge;
                //Table2.Attributes.Add("onclick","return confirm('是否继续测试?');");
            }
  • 相关阅读:
    sql 读取txt 文件内容,并写入sql的方法
    Thread.Mutex 互斥体
    SQL语句创建登录名,数据库用户,数据库角色及分配权限:
    倾国倾城 歌词
    LINUX下c/c++的学习(4)linux file and direction(stat fstat lstat access umask chmod ...)
    飞蛾扑火
    生成验证码点击可刷新
    C#项目调用非托管代码函数的方法
    【学习】数据库事务
    如何判断数据库是否存在
  • 原文地址:https://www.cnblogs.com/ziyan22/p/909032.html
Copyright © 2011-2022 走看看