No 31・Webページでの表コントロールの使用


#define Hywork 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AddRow(" ", " ", " ", " ");
        AddRow(" ", " ", " ", "http://www.mingrisoft.com");
        AddRow(" ", " ", " ", "http://www.mingrisoft.com");
        AddRow(" ", " ", " ", "http://www.mingrisoft.com");
        AddRow(" ", " ", " ", "http://www.mingrisoft.com");
        AddRow(" ", " ", " ", "http://www.mingrisoft.com");
  
    }
    public void AddRow(string strName1, string strName2, string strName3, string strName4)
    { 
        TableRow row = new TableRow();
        // 1 
        TableCell cell1 = new TableCell();
        cell1.Font.Size = FontUnit.XXSmall;
        cell1.Text = strName1;
        cell1.Width = 80;
        row.Cells.Add(cell1);
        // 2 
        TableCell cell2 = new TableCell();
        cell2.Font.Size = FontUnit.XXSmall;
        cell2.Text = strName2;
        cell2.Width = 80;
        row.Cells.Add(cell2);
        // 3 
        TableCell cell3 = new TableCell();
        cell3.Font.Size = FontUnit.XXSmall;
        cell3.Text = strName3;
        cell3.Width = 80;
        row.Cells.Add(cell3);
        // 4 
        HyperLink hyperLink = new HyperLink();
        hyperLink.Text = strName4;
        hyperLink.NavigateUrl = strName4;
        hyperLink.Target = "_top";
        TableCell cell4 = new TableCell();
        cell4.Font.Size = FontUnit.XXSmall;
        cell4.Controls.Add(hyperLink);
        cell4.Width = 240;
        row.Cells.Add(cell4);
        this.Table1.Rows.Add(row);
    }


}