469,354 Members | 2,046 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,354 developers. It's quick & easy.

Border in C# Table programmatically - Several adjacent horiz & verti cells empty

Border drawn in C# Table programmatically even if several adjacent horizontal & vertical cells are empty in the table

I want to programmatically have border on each and every row and column in the table even if several adjacent horizontal and vertical cells contains no value. The table control (MyTbl) is in ASP. I am programmatically populating the TableCell and TableRow in that MyTbl in ASP. The problem is, no line for the row border gets created if two consecutive rows for a given column are empty. My goal is to have row border for each and every row and column irrespective of the cell value being empty. The MyTbl control in ASP has Gridlines set as both and Borderstyle as solid.

MyTbl control in ASP gets populated as:

TableRow r = new TableRow();

//r.BorderStyle = BorderStyle.Solid;

TableCell cellID = new TableCell();

//cell.BorderStyle = BorderStyle.Solid;

cellID.Text = ..... some kind of value

//r.BorderStyle = BorderStyle.Solid;

r.Cells.Add(cellID);

MyTbl.Rows.Add(r);

I tried adding BorderStyle as Solid to both row and cell with no luck. If two corresponding rows for a given column are empty, no boundary line is drawn between two columns.

How can I have boundary line for each and every row and column even if several horizontal and vertical cells have no value?
Jan 24 '07 #1
2 16229
enreil
86
You may want try asking this in the ASP forum as well...

Border drawn in C# Table programmatically even if several adjacent horizontal & vertical cells are empty in the table

I want to programmatically have border on each and every row and column in the table even if several adjacent horizontal and vertical cells contains no value. The table control (MyTbl) is in ASP. I am programmatically populating the TableCell and TableRow in that MyTbl in ASP. The problem is, no line for the row border gets created if two consecutive rows for a given column are empty. My goal is to have row border for each and every row and column irrespective of the cell value being empty. The MyTbl control in ASP has Gridlines set as both and Borderstyle as solid.

MyTbl control in ASP gets populated as:

TableRow r = new TableRow();

//r.BorderStyle = BorderStyle.Solid;

TableCell cellID = new TableCell();

//cell.BorderStyle = BorderStyle.Solid;

cellID.Text = ..... some kind of value

//r.BorderStyle = BorderStyle.Solid;

r.Cells.Add(cellID);

MyTbl.Rows.Add(r);

I tried adding BorderStyle as Solid to both row and cell with no luck. If two corresponding rows for a given column are empty, no boundary line is drawn between two columns.

How can I have boundary line for each and every row and column even if several horizontal and vertical cells have no value?
Jan 24 '07 #2
kenobewan
4,871 Expert 4TB
I believe that you will get better results using CSS, rather than trying to program the table border style. Set its border, width and color in your stylesheet...

Hope that this helps.
Jan 25 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by David Tilman | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.