Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change bordercolor

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
0
0
US
You would think this would be easy, but its not cooperating. I'm trying to create a table on the fly and change the border color of the cell. I know that BorderWidth is working because the box shrinks in size as I make the width larger, but the color is still white. Any help is appreciated.

TableCell tzCell = new TableCell();
tbRow.Cells.Add(tzCell);
tzCell.Width = 20;
tzCell.Height = 20;
tzCell.BorderStyle = BorderStyle.Outset;
tzCell.BorderWidth = 1;
tzCell.BorderColor = Color.Black; //System.Drawing.Color.Black
tzCell.BackColor = GetColor(j);
 
Give the cell a CSS class instead of setting attributes then it will be easier to change (i.e. you can do it in the CSS page without deploying the project each time you decide to make a change) and it will also generate valid HTML code.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Ok, I moved it into a CSS and I'm having the same exact problem.
 
I figured it out. There needs to be text in the cell for the border to display. I do not want any text so I did this tzCell.Text = " "; and that did it.
 
There doesn't have to be text in the cell for it to have a border - check out the empty-cells property in CSS.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top