Gridview Conditional Formatting ?

E

euan

HI Guys,

I have bee using conditional formatting in the datagrid recently and I
am moving over to framework 2.0 and noticed the datagrid has been
replaced by the gridview. So, I would like to do conditional formatting
on the gridview but it doesnt have the same methods.

Currently in my datagrid I have this (this is just hacked together
randomly but gives you the idea):

Sub ItemDataBoundEventHandler(ByVal sender As Object, ByVal e As _
DataGridItemEventArgs)
Dim m As String = DataBinder.Eval(e.Item.DataItem, "name")
If Trim(m) = "Euan" Then
e.Item.Cells(1).BackColor = System.Drawing.Color.Yellow
e.Item.Cells(1).Text = e.Item.Cells(1).Text & "*"
End If
End Sub

But I would like to achieve something like that in gridview.

Further to that (if anyone knows), does anyone know how I could
intelligently detect the column number of the column "name" in
gridview?

This may seem like a stupid question but I am reasonably new to asp.net

Regards,
Euan
 

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

Top