⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compositetablecontrol_step1.cs

📁 东软内部材料(四)asp等相关的教学案例 
💻 CS
字号:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WroxControls 
{
   public class CompositeTableControl : Control 
   {
      Table _table;  // Make table a member so we can access it at any point
 
      protected override void CreateChildControls()
      {
         LiteralControl text;

         text = new LiteralControl(
                      "<h1>ASP.NET Control Development in C#</h1>");
         Controls.Add(text);

         TableRow row;
         TableCell cell;

         // Create a table and set a 2 pixel border

         _table = new Table();
         _table.BorderWidth = 2;

         Controls.Add(_table);

         // Add 10 row each with 5 cells 

         for(int x = 0; x < 10; x++) {
            // Create a row and add it to the table
         
            row = new TableRow();
            _table.Rows.Add(row);

            // Create a cell that contains the text

            for(int y = 0; y < 5; y++) {

               text = new LiteralControl("Row: " + x + " Cell: " + y);

               cell = new TableCell();
               cell.Controls.Add(text);

               row.Cells.Add(cell);
               }
           }
       }
   }
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -