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

Creating a currency column

7 Answers 752 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hilda Kenny
Top achievements
Rank 1
Hilda Kenny asked on 18 Nov 2010, 04:31 PM
Hi, i have a value e.g.  23.0000   how do make this a euro value such as €23.00    ?   thanks for any help.

7 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 18 Nov 2010, 04:53 PM
Hello,

Your column needs to be a decimal column and you can then format that column as currency.
For exmaple.
Me.RadGridView1.Columns.Add(New GridViewDecimalColumn("Currency")) 
Me.RadGridView1.Columns(0).FormatString = "{0:C}"

hope that helps
Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 18 Nov 2010, 06:22 PM
Hi, thanks for the response. I added it in the property designer but the € sign doesn't come up, an unrecognizable symbol appears instead. I have attached a screenshot.  thanks.
0
Richard Slade
Top achievements
Rank 2
answered on 18 Nov 2010, 06:33 PM
Hello,

there is no screenshot. Please can you attach
thanks
richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 18 Nov 2010, 10:14 PM
Hello,

This will format your column with a Euro symbol.
Imports Telerik.WinControls
Imports Telerik.WinControls.UI
Imports System.Globalization
  
Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
        Me.RadGridView1.Columns.Add(New GridViewDecimalColumn("Currency"))
  
        Dim rowInfo As GridViewRowInfo = Me.RadGridView1.Rows.AddNew()
        rowInfo.Cells(0).Value = "2.32"
        rowInfo = Me.RadGridView1.Rows.AddNew()
        rowInfo.Cells(0).Value = "4.36"
  
    End Sub
  
    Private Sub RadGridView1_CellFormatting(ByVal sender As System.Object, _
        ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.CellFormatting
  
        If e.Column.Name = "Currency" Then
            e.CellElement.Text = String.Format(New CultureInfo("fr-FR"), "{0:C}", e.CellElement.Value)
        End If
    End Sub
End Class

Hope this helps
Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 19 Nov 2010, 10:38 AM
Thanks I'll give it a go
0
Richard Slade
Top achievements
Rank 2
answered on 19 Nov 2010, 10:42 AM
Ok, great. Let me know how you get on and if you find this is a solution for you, please remember to mark as answer so others can find the answer too.

All the best
Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 22 Nov 2010, 10:40 AM
It worked thank you very much
Tags
GridView
Asked by
Hilda Kenny
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Hilda Kenny
Top achievements
Rank 1
Share this question
or