i have a problem , i can create an html table from code behind and can add rows to it. but i want to know that , According to a condition , when the condition gets true a new html table will be created else a new row will be added to the existing table.
please Help !!
ishwarPosted May 6, 2015, 9:48 AM
RACHIT JAINPosted Feb 27, 2015, 9:03 AM
Azhar HameedPosted Jul 2, 2013, 3:54 AM
Sanjeeb LenkaPosted Jul 2, 2013, 3:10 AM
http://www.dotnetcurry.com/ShowArticle.aspx?ID=135
Ish BandhuPosted Jul 2, 2013, 2:38 AM
private void AddRowInTable()
{
HtmlTableRow tr1 = new HtmlTableRow();
HtmlTableCell tc1 = new HtmlTableCell();
tc1.Width="20px";
tc1.Height = "20px";
HtmlTableCell tc2 = new HtmlTableCell();
tc2.Width = "20px";
tc2.Height = "20px";
tr1.Controls.Add(tc1);
tr1.Controls.Add(tc2);
table1.Controls.Add(tr1);
//table1 is existing table
}
//For create new table
private void CreateTable()
{
HtmlTable ht = new HtmlTable();
ht.Border = 1;
HtmlTableRow tr1 = new HtmlTableRow();
HtmlTableCell tc1 = new HtmlTableCell();
tc1.Width="20px";
tc1.Height = "20px";
tc1.InnerText="Name:";
HtmlTableCell tc2 = new HtmlTableCell();
tc2.Width = "20px";
tc2.Height = "20px";
tc2.InnerText = "New Table";
tr1.Controls.Add(tc1);
tr1.Controls.Add(tc2);
ht.Controls.Add(tr1);
Page.Controls.Add(ht);
}