Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / For Currency format display minus symbol for negative value

For Currency format display minus symbol for negative value

New Discussion
Birendra Aujla
Birendra Aujla asked on Nov 30, 2016 12:03 PM

In infragistics webdatagrid, I had defined BoundDataField like below to display currency symbol. In case the value is negative, it displays value in bracket rather then displaying minus(-) symbol. How can I display minus sign rather then bracket for negative value?

 

Sign In to post a reply

Replies

  • 0
    Radoslav Karaivanov
    Radoslav Karaivanov answered on Nov 1, 2016 2:34 PM

    Hello Birendra,

    Thank you for contacting Infragistics Developer Support!

    You should try setting EnableScriptGlobalization and EnableScriptLocalization off the ScriptManager to True.

    For example:

    <ig:WebScriptManager id="sm" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true"></ig:WebScriptManager>

    • 0
      Birendra Aujla
      Birendra Aujla answered on Nov 2, 2016 5:41 AM

      Thanks Radoslav for replying. I had applied the same on Master page but it didnot worked for grid present in  ContentPage.

      • 0
        Birendra Aujla
        Birendra Aujla answered on Nov 7, 2016 6:14 AM

        Admin, please don't 'Mark as answer' since my issue is not resolved by the suggestion mentioned.

      • 0
        Radoslav Karaivanov
        Radoslav Karaivanov answered on Nov 21, 2016 2:45 PM

        Hello Birendra,

        I suspect the problem is due to your master page overriding the culture settings in your content pages.

        I suggest you implement InitializeCulture() in your BasePage class and set it to your preferred local settings.

        For additional information you can check out this thread

        Feel free to contact me for further assistance.

      • 0
        Birendra Aujla
        Birendra Aujla answered on Nov 30, 2016 12:03 PM

        Since the above suggestion didn't work, so I had done it like below.

        In .ascx, defined the field inside webdatagrid as under:

         <ig:UnboundField Header-Text="Cash Received" Key="Cash Received"></ig:UnboundField>

        Inside InitializeRow event defined it like below:

        protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)

        {

             if(e.Row.DataItem !=null)

             {

                Client cln=e.Row.DataItem as Client;

                if(cln.CashRec < 0)

               {

                  String strCR = cln.CashRec.ToString("f2");  //Two places of decimal

                 e.Row.Items[4].Value= string.Format("-${0}", strCR.Substring(1, strCR.Length -1));    //Added minus sign & Dollar symbol

               }

              else

                   e.Row.Items[4].Value= string.Format("${0}",cln.CashRec);   //Added Dollar symbol

             }

        }

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Birendra Aujla
Favorites
0
Replies
5
Created On
Nov 30, 2016
Last Post
9 years, 3 months ago

Suggested Discussions

Created by

Created on

Nov 30, 2016 12:03 PM

Last activity on

Feb 26, 2026 7:14 PM