Negative currency values are shown in bracket in the report

6 posts, 1 answers
  1. Simon
    Simon avatar
    56 posts
    Member since:
    May 2008

    Posted 22 Jul Link to this post

    Hello,

    I would like to show negative currency values with the negative symbol instead of bracket in the telerik report. E.g. -$101.00 instead of ($203.00) or -€101.00 instead of (€101.00) - we use different currencies in the app. I set this.Culture.NumberFormat.CurrencyNegativePattern = 1; in the *.Designer.cs file. The application compiles correctly and the values show properly, but the report in the design mode has an error:
    at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
    Do you have the information how to fix the issue?

  2. Nasko
    Admin
    Nasko avatar
    1021 posts

    Posted 24 Jul Link to this post

    Hello Simon,

    This is the summary at the top of the *.Designer.cs file:
    #region Component Designer generated code
    /// <summary>
    /// Required method for telerik Reporting designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()

    If possible, place any custom code in the *.cs file of the report (in the report's constructor).

    Regards,
    Nasko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Simon
    Simon avatar
    56 posts
    Member since:
    May 2008

    Posted 25 Jul in reply to Nasko Link to this post

    Hello Nasko,

            private void InitializeComponent()
            {
                this.entityDataSource1 = new Telerik.Reporting.EntityDataSource();
                this.detail = new Telerik.Reporting.DetailSection();
                this.textBox1 = new Telerik.Reporting.TextBox();
                ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
                //
                // entityDataSource1
                //
                this.entityDataSource1.ConnectionString = "GeneralDataContext";
                this.entityDataSource1.Context = typeof(General.Data.Models.GeneralDataContext);
                this.entityDataSource1.ContextMember = "GetData";
                this.entityDataSource1.Name = "entityDataSource1";
                //
                // detail
                //
                this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                this.textBox1});
                this.detail.Name = "detail";
                //
                // textBox1
                //
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(1.2000001668930054D), Telerik.Reporting.Drawing.Unit.Inch(0.20000000298023224D));
                this.textBox1.Format = "{0:C}";
                this.textBox1.Value = "= Fields.value";
                //
                // Report
                //
                this.Culture = new System.Globalization.CultureInfo("en-US");
                this.Culture.NumberFormat.CurrencyNegativePattern = 1;
                this.DataSource = this.entityDataSource1;
                this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                this.detail});
                this.Name = "Report";
                ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            }
            #endregion
            private Telerik.Reporting.DetailSection detail;
            private Telerik.Reporting.EntityDataSource entityDataSource1;
            private TextBox textBox1;
  4. Answer
    Nasko
    Admin
    Nasko avatar
    1021 posts

    Posted 26 Jul Link to this post

    Hello Simon,

    You are still changing code manually inside the InitializeComponent method in *.Designer.cs. You should not be doing that, as this will break the report designer.

    The *.Designer.cs file should not be modified manually:
    #region Component Designer generated code
    /// <summary>
    /// Required method for telerik Reporting designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()

    If you modify this file in any way, the report designer will break, exactly as shown in your screenshot.

    Instead of doing that, please move the custom code to the report's constructor.

    Regards,
    Nasko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Simon
    Simon avatar
    56 posts
    Member since:
    May 2008

    Posted 26 Jul in reply to Nasko Link to this post

    Hello Nasko,

    It works, thanks.
  6. Simon
    Simon avatar
    56 posts
    Member since:
    May 2008

    Posted 26 Jul in reply to Nasko Link to this post

    Hello Nasko,

    It works, thanks.
Back to Top