zoukankan      html  css  js  c++  java
  • 服务器端Table控件的操作

    protected void CreateTable()
        {
            TableRow tblrNewRow;
            TableCell tblcNewCell;

            int iRowNumber = 5;
            int iCellNumber = 5;

            for (int iRowIndex = 0; iRowIndex < iRowNumber; iRowIndex++)
            {
                tblrNewRow = new TableRow();

                for (int iCellIndex = 0; iCellIndex < iCellNumber; iCellIndex++)
                {
                    tblcNewCell = new TableCell();

                    if (iCellIndex == 1)
                    {
                        TextBox tb = new TextBox();
                        tb.ID = "tb" + iRowIndex.ToString() + iCellIndex.ToString();
                        tb.Text = "tb" + iRowIndex.ToString() + iCellIndex.ToString();
                        tblcNewCell.Controls.Add(tb);
                    }
                    else if (iCellIndex == 3)
                    {
                        int count = 0;
                        DropDownList dropNew = new DropDownList();
                        dropNew.ID = "drop" + iRowIndex.ToString() + iCellIndex.ToString();
                        for (int i = 0; i < 10; i++) dropNew.Items.Add(iRowIndex.ToString() + count++);
                        tblcNewCell.Controls.Add(dropNew);
                    }
                    else
                    {
                        Button btn = new Button();
                        btn.ID = "btn" + iRowIndex.ToString() + iCellIndex.ToString();
                        btn.Text = "按钮" + iRowIndex.ToString() + iCellIndex.ToString();
                        btn.Click += new EventHandler(btn_Click);
                        tblcNewCell.Controls.Add(btn);
                    }

                    tblrNewRow.Cells.Add(tblcNewCell);
                }

                tblShopCar.Rows.Add(tblrNewRow);
            }
        }

  • 相关阅读:
    Educational Codeforces Round 13 E. Another Sith Tournament 概率dp+状压
    Codeforces Round #358 (Div. 2) D. Alyona and Strings 字符串dp
    Codeforces Round #359 (Div. 2) D. Kay and Snowflake 树的重心
    Codeforces Round #311 (Div. 2) D. Vitaly and Cycle 奇环
    Codeforces Round #Pi (Div. 2) E. President and Roads 最短路+桥
    Codeforces Gym 100342J Problem J. Triatrip 三元环
    HDU 4587 TWO NODES 割点
    hdu 5615 Jam's math problem(十字相乘判定)
    C++数组作为函数参数的几个问题(转)
    UVA
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1202895.html
Copyright © 2011-2022 走看看