Ticket Q206150
Visible to All Users

GridColumn DisplayFormat percent

created 16 years ago

I have the following code:
DevExpress.XtraGrid.Columns.GridColumn interestRateColumn1 = rqView.AddColumn(LoanRow.InterestRateField, GetDisplayDescription(LoanRow.InterestRateField), 10, readOnly);
interestRateColumn1.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
interestRateColumn1.DisplayFormat.FormatString = "p";
gridView1.Columns.Add(interestRateColumn1);
interestRateColumn1.Visible = true;
This value in the database is: 5.5
I would expect the grid to display 5.5% but instead I am seeing 550%.
I have also tried (with the same results):
DevExpress.XtraGrid.Columns.GridColumn interestRateColumn = rqView.AddColumn(LoanRow.InterestRateField, GetDisplayDescription(LoanRow.InterestRateField), 10, readOnly);
interestRateColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
interestRateColumn.DisplayFormat.FormatString = "###.##%";
gridView1.Columns.Add(interestRateColumn);
interestRateColumn.Visible = true;

Show previous comments (1)
?
Unknown 16 years ago

    I'm sorry - I pasted the wrong code in my initial post. I am using the "P" option and getting an output result of 550%. If I use "p" I get 5500%. Again, the value in the DB is 5.5. If I change the FormatString to "n" I see 5.50 - as expected. I checked the value in the debugger - it is, indeed, 5.5.
    Thanks.

    Dennis Garavsky (DevExpress) 16 years ago

      Hello Charlie,
      Thanks for the update.
      Please check the sample I attached previously. It all works fine for me. Does it work the same way for you? Please let me know.
      Thanks,
      Dennis

      ?
      Unknown 16 years ago

        Your example works perfectly - and so does my code now that I fixed an erroneous variable reference…thanks for your help and the demo app.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.