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

  • 相关阅读:
    WebMatrix简介与预览
    使用NuGet增加常见包引用
    用Jquery实现的一个Table的帮助js
    使用AspNetPager进行存储过程分页
    Android之旅AppWidget
    SQL积累
    【问题记录】Asp.net WebApplication和WebSite中用户控件的使用区别
    ActionScript 3.0工厂模式实例
    ActionScript 3.0 实现单态模式
    装饰器模式小结
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1202895.html
Copyright © 2011-2022 走看看