This is a migrated thread and some comments may be shown as answers.

RADGridView Formatting

3 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zerka
Top achievements
Rank 1
Zerka asked on 08 Dec 2010, 02:03 PM
Hi

I want to underline the values of a column in RadGridView. Can you please tell me how to do this?

Thanks

Regards

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 08 Dec 2010, 03:20 PM
Hello,

You need to use the Cellformatting event to do that. Please consider the following example

Private Sub RadGridView1_CellFormatting1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.CellFormatting
    If e.CellElement.ColumnInfo.Name = "Name" Then
        e.CellElement.Font = New Font("Segoe UI", 8.25, FontStyle.Underline)
    Else
        e.CellElement.ResetValue(LightVisualElement.FontProperty)
    End If
End Sub

You can find out more about CellFormatting at This help article

hope that helps
Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 08 Dec 2010, 03:26 PM
Hello again,

To maintain consistancy without hard coding the font name, the below replaces the code above.

Private Sub RadGridView1_CellFormatting1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.CellFormatting
    If e.CellElement.ColumnInfo.Name = "Name" Then
        e.CellElement.Font = New Font(Me.RadGridView1.Font.Name, Me.RadGridView1.Font.Size, FontStyle.Underline)
    Else
        e.CellElement.ResetValue(LightVisualElement.FontProperty)
    End If
End Sub

All the best
richard
0
Zerka
Top achievements
Rank 1
answered on 09 Dec 2010, 08:59 AM
Thanks!

Regards!
Tags
GridView
Asked by
Zerka
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Zerka
Top achievements
Rank 1
Share this question
or