Link to home
Start Free TrialLog in
Avatar of eladr
eladr

asked on

setting font.bold=true in datagrid in case...

i have datagrid with 2 templated coulmns which give me name + profession from DB.
i have another field which it's value is 0
if the field value is 1 i want to change the font to bold . (name + profession will be bold in the specific row)
 
10x
e.
 
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are doing this in ASP.Net then use something like the following:

Private Sub dgResults_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgResults.ItemDataBound

        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

            If CType(CType(e.Item.DataItem, DataRowView).Row.Item(0), Integer) = 0 Then
                e.Item.BackColor = System.Drawing.Color.White
            End If

        End If

    End Sub

James :-)
I have given a valid link to answer.

My recommandation: Points to emoreau.