Select Table tool from toolbar and name it as TBL
and declare the Variables
int I;
//ICOL denotes the number of Coloumn
//IROW denotes the number of Rows
string[] HSTR = { "ROLLNO", "NAME", "MARKS", "", "" };
TableHeaderRow HR = new TableHeaderRow();
TBL.Controls.Add(HR);
for (I = 0; I <= 4; I++)
{
TableHeaderCell HCELL = new TableHeaderCell();
HR.Cells.Add(HCELL);
HCELL.Text = HSTR[I];
}
for (I = 1; I <= IROW; I++)
{
TableRow TROW = new TableRow();
TBL.Controls.Add(TROW);
for (j = 0; j < ICOL - 2; j++)
{
TableCell TCELL = new TableCell();
TROW.Cells.Add(TCELL);
}
TableCell TCELL1 = new TableCell();
TROW.Cells.Add(TCELL1);
TextBox TXT = new TextBox();
TB[I] = TXT;
TCELL1.Controls.Add(TB[I]);
TableCell TCELL2 = new TableCell();
TROW.Cells.Add(TCELL2);
and declare the Variables
int I;
//ICOL denotes the number of Coloumn
//IROW denotes the number of Rows
string[] HSTR = { "ROLLNO", "NAME", "MARKS", "", "" };
TableHeaderRow HR = new TableHeaderRow();
TBL.Controls.Add(HR);
for (I = 0; I <= 4; I++)
{
TableHeaderCell HCELL = new TableHeaderCell();
HR.Cells.Add(HCELL);
HCELL.Text = HSTR[I];
}
for (I = 1; I <= IROW; I++)
{
TableRow TROW = new TableRow();
TBL.Controls.Add(TROW);
for (j = 0; j < ICOL - 2; j++)
{
TableCell TCELL = new TableCell();
TROW.Cells.Add(TCELL);
}
TableCell TCELL1 = new TableCell();
TROW.Cells.Add(TCELL1);
TextBox TXT = new TextBox();
TB[I] = TXT;
TCELL1.Controls.Add(TB[I]);
TableCell TCELL2 = new TableCell();
TROW.Cells.Add(TCELL2);
No comments:
Post a Comment