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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BGColor of Textbox in ItemTemplate of DataGrid

Status
Not open for further replies.

wallaceoc80

Programmer
Jul 7, 2004
182
GB
I have a DataGrid that uses Textboxes to display data from a database. The reason I use textboxes is because the contents are long file names without spaces that cause problems for my column widths.

I have set up the DataGrid to have a different background color for alternating rows. To try and make my TextBoxes fit in I have set the background color of them to the the color of the DataGrid.

However, this means that the TextBoxes only have the correct background color every second row. Is there any way that I can set it up so that the background color of the Textboxes also alternat every second row?

Thanks for the help,

Wallace
 
Wallace: not sure how background color of textbox is inteferring with alternating grid colors which are set on the Itembound event -- and 'fitting' -- provide a bit of code on this and we'll take a look (in the meanwhile, someone may right away recognize what is going on).
 
It isn't interfering. I have set the DataGrid to a style that has alternating background colour every line. Each line contains a textbox and what I want is for the textbox to have the same background colour as the DataGrid. This means that I need the Textbox's backgournd colour to alternate every line.
 
try adding
Code:
style="background-color: transparent;"
to every textbox that you add.

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top