Gridview - conditional formatting

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hey,

In order to customise rows on my gridview control, I've some code in the RowDataBound event, that works on each row, altering it's attributes..

for example I have:

If gvResults.DataKeys.Item(e.Row.RowIndex).Values.Item(1).ToString() = "True" Then

e.Row.BackColor = Drawing.Color.LightGray
e.Row.ForeColor = Drawing.Color.Black
e.Row.Cells(1).Enabled = False

which tests a rows' hidden value (in a datakey) and acts accordingly on the row... cells(1) holds a button.

Now I wish to do more to the row than just enable/disable it and change colours.. supposing I wanted to change the text on the button - is this possible?

If I do:
e.Row.Cells(1).Text = "Provide contact information"

it replaces the whole button with just some text.. how can I access the buttons' .text property?

Cheers,
Chris
.


Quantcast