how to add a dynamic table in a panel at runtime in c#

I am creating html formatted tables at runtime with uniques ID's using the following code

PopDefinition table = new PopDefinition();
                StringBuilder html = new StringBuilder();
                html.Append(string.Format("<table runat=" + "server" + " id={0}subtable{1}{0} class={0}gridview_table{0}>", _dq, " " + Convert.ToString(_laid[i]) + Convert.ToString(j + 1)));
                _headerlist.Clear();
                html.Append(createheader(table.headers, "subtable"));
                DataRow[] dr = _mainset.Tables[0].Select();
                html.Append(createbody(table.columns, dr, "subtable"));
                html.Append(createfooter(table.footers, "subtable"));
                html.Append("</table>");

and get html as attached in the code part. how can I store these tables in some sort of a control like panel control and make the ones visible which i need.
Thanks,



<table runat=server id="subtable 82" class="gridview_table"><tr class="gridview_altrow"><th rowspan="" colspan="">LA Areas</th><th id="Th56" laid="PGS" class="yearcode" term="subtable">PGS</th><th>&nbsp</th><th rowspan="" colspan="">Request Totals</th></tr><tr><th id="Th57" laid="8-1" class="area" term="subtable">Bute</th><td><input type="text" value ="0" id="Text120" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text121" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th id="Th58" laid="8-2" class="area" term="subtable">Cowal</th><td><input type="text" value ="0" id="Text122" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text123" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr><th id="Th59" laid="8-3" class="area" term="subtable">Helensburgh & Lomond</th><td><input type="text" value ="0" id="Text124" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text125" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th id="Th60" laid="8-4" class="area" term="subtable">Islay and Jura</th><td><input type="text" value ="0" id="Text126" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text127" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr><th id="Th61" laid="8-5" class="area" term="subtable">Kintyre North</th><td><input type="text" value ="0" id="Text128" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text129" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th id="Th62" laid="8-6" class="area" term="subtable">Kintyre South</th><td><input type="text" value ="0" id="Text130" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text131" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr><th id="Th63" laid="8-7" class="area" term="subtable">Lorn, Coll & Colonsay</th><td><input type="text" value ="0" id="Text132" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text133" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th id="Th64" laid="8-8" class="area" term="subtable">Mid-Argyll</th><td><input type="text" value ="0" id="Text134" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text135" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr><th id="Th65" laid="8-9" class="area" term="subtable">Mull and Iona</th><td><input type="text" value ="0" id="Text136" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text137" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th id="Th66" laid="8-10" class="area" term="subtable">Tiree</th><td><input type="text" value ="0" id="Text138" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text139" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr><th id="Th67" laid="8" class="area" term="subtable">Unspecified, TBA</th><td><input type="text" value ="0" id="Text140" maxlength = "5"  onblur="checkvalue(this.id); dosum(this.id, new Array('subjectrequesttotals','fPGS_0'));"  /></td><th>&nbsp</th><td><input type="text" value="0" id="Text141" maxlength="5" thefuntion="sum(row)" readonly = "true" class = "noenter"/></td></tr><tr class="gridview_altrow"><th rowspan="" colspan="">Total</th><td><input type="text" value="0" id="Text142" maxlength="5" thefuntion="sum(PGS)" readonly = "true" class = "noenter"/></td><th>&nbsp</th><td><input type="text" value="0" id="Text143" maxlength="5" thefuntion="sum(subjectrequesttotals)" readonly = "true" class = "noenter"/></td></tr></table>

Open in new window

mmalik15Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carlnorrbomCommented:
Hi,

You should be able to do something simple like:

After your code above, add:

LiteralControl lit = new LiteralControl();
lit.Text = html.ToString();
Page.Controls.Add(lit);


And you can also toggle visibility like:

lit.Visible = false  / true;

/Carl.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
>how to add a dynamic table in a panel
To a Winforms panel?
0
mmalik15Author Commented:
....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.