Gridview & Dynamic Formatting

K

katmagic

I am trying to dynamically format a gridview based on results. basically
I'm
saying if the datasource does not returns the same number of records as
another datasource (iNumberToMatch), I want the gridview in red. But it is
being ignored; I have taken off all skins and even moved the code to a
separate application and separate webpage with no masters or skins and it
still doesn't display in red like it should. When I debug it is landing on
the row style change correctly, but it's not appearing in red. What am I
doing wrong?

Here is my code:

This is a nested grid, and eRow is being passed from the parent grid's
rowdatabound event:

gv = cType(eRow.findControl("gvClientMatch"), gridview)
If not gvClientOrderMatch is nothing
Dim sID as String
Dim ds as New DataSet
lbl = cType(erow.FindControl("lblOrderID"), label)
If not lbl is nothing
sID = lbl.text
ds = GetClientMatch(sID)
If not ds is nothing
If iNumberToMatch > 1
If ds.Tables(0).Rows.Count <> iNumberToMatch-1
gv.RowStyle.Font.Italic=True
gv.RowStyle.ForeColor=Drawing.Color.Red
End If
End if
End If
gv.datasource=ds
gv.DataBind
End If
 

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

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top