Apply style to a dynamic table in ASP.NET page


H

Hardy Wang

Hi,
I have a PlaceHolder control, I need to dynamic render a HTML table to
add to this place holder. One requirement of this table is, I need style
like below
<table style="margin-left: 5;">

In my C# code, I have following code to render the table, how can I add this
style to my table?
Table t = new Table();
t.BorderWidth = 1;
t.GridLines = GridLines.Both;
t.CellPadding = 0;
t.CellSpacing = 0;
t.Width = Unit.Percentage(95);
TableRow tr = new TableRow();
TableCell tc1 = new TableCell();
tc1.Width = Unit.Percentage(30);
tc1.CssClass = "Section";
tc1.Text = "some value here";
tc1.VerticalAlign = VerticalAlign.Top;
tr.Cells.Add(tc1);
t.Rows.Add(tr);
myPlaceHolder.Controls.Add(t);
....................
--

Thanks for any suggestion!!!


WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top