PDA

View Full Version : مشکل در ساخت table



mehran_286
یک شنبه 11 مرداد 1394, 17:30 عصر
سلام دوستان
کد زیر از لحاظ ویژوال استودیو هیچ مشکلی نداره
اما هنگام اجرا ارور
'HtmlTable' cannot have children of type 'TableRow'.میده

کد سی شارپ
protected void cmdcreate_Click(object sender, EventArgs e)
{
tbl.Controls.Clear();
int rows = Int32.Parse(txtrows.Text);
int cols = Int32.Parse(txtcols.Text);
TableCell cellnew = null;
for (int row=0;row <rows ;row ++)
{
TableRow rownew = new TableRow();
tbl.Controls.Add(rownew);
for(int col=0 ;col<cols ;col ++)
{
cellnew = new TableCell();
cellnew.Text ="EXAMPLE cell+("+row.ToString()+",";
cellnew.Text += col.ToString() + ",";
if (chkburder .Checked )
{
cellnew.BorderStyle = BorderStyle.Inset;
cellnew.BorderWidth = Unit.Pixel(1);

}
rownew.Controls.Add(cellnew);

}




}
}
}