Table kontrol örneği için tıklayınız..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication12
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int rows = Int32.Parse(TextBox1.Text);
int cols = Int32.Parse(TextBox2.Text);
for (int row = 0; row < rows; row++)
{
TableRow rowNew = new TableRow();
tbl.Controls.Add(rowNew);
for (int col = 0; col < cols; col++)
{
TableCell cellNew = new TableCell();
cellNew.Text = "Örnek Hücre (" + row.ToString() + ",";
cellNew.Text += col.ToString() + ")";
if (CheckBox1.Checked)
{
cellNew.BorderStyle = BorderStyle.Inset;
cellNew.BorderWidth = Unit.Pixel(1);
}
// Put the TableCell in the TableRow.
rowNew.Controls.Add(cellNew);
}
}
}
}
}