How to change currency symbol in Summary row

4 posts, 1 answers
  1. Shanti 😎
    Shanti 😎 avatar
    31 posts
    Member since:
    Jun 2016

    Posted 27 Oct 2020 Link to this post

    Hi,

    How to change currency symbol in Summary row. Currency showing default dollar symbol. I want to replace with Indian currency symbol.

    This is my code.

     

    Dim summaryRowItem As GridViewSummaryRowItem = New GridViewSummaryRowItem()

            For i = 1 To RadGridView.Columns.Count - 1

                Dim summaryItem As GridViewSummaryItem = New GridViewSummaryItem()
                summaryItem.Name = RadGridView.Columns(i).Name

                If TypeOf RadGridView.Columns(i) Is GridViewDecimalColumn Then

                    summaryItem.Aggregate = GridAggregateFunction.Sum
                    summaryItem.FormatString = "{0:c}"
                    summaryRowItem.Add(summaryItem)

                End If

            Next

            RadGridView.SummaryRowsTop.Add(summaryRowItem)
            RadGridView.MasterView.SummaryRows(0).PinPosition = PinnedRowPosition.Bottom

     

    Thank you.

  2. Answer
    Nadya
    Admin
    Nadya avatar
    459 posts

    Posted 27 Oct 2020 Link to this post

    Hello, Shanti,

    RadGridView offers the GroupSummaryEvaluate event where you have access to the calculated value according to the values that are stored in the respective cells. Thus, you can format what exactly is displayed in the summary cell. More information is available here: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/summary-rows 

    Please refer to the following code snippet:

    Private Sub RadGridView1_GroupSummaryEvaluate(ByVal sender As Object, ByVal e As GroupSummaryEvaluationEventArgs)
        If e.SummaryItem.Name = "UnitPrice" Then
            e.FormatString = String.Format("₹ {0}", e.Value)
        End If
    End Sub

    I hope this information helps. Should you have other questions please let me know.

    Regards,
    Nadya
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  3. Shanti 😎
    Shanti 😎 avatar
    31 posts
    Member since:
    Jun 2016

    Posted 28 Oct 2020 in reply to Nadya Link to this post

    Thank you..

     

     Private Sub grdSearch_GroupSummaryEvaluate(sender As Object, e As GroupSummaryEvaluationEventArgs)
            If e.Value IsNot Nothing Then
                Dim culture As CultureInfo = Nothing
                culture = New CultureInfo("hi-IN")
                e.FormatString = String.Format(culture, "{0:c}", e.Value)
            End If
        End Sub

  4. Nadya
    Admin
    Nadya avatar
    459 posts

    Posted 28 Oct 2020 Link to this post

    Hello, Shanti,

    Using the CultureInfo class is also a possible solution. Thank you for sharing it with the community. 

    Should you have other questions do not hesitate to contact us.

    Regards,
    Nadya
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top