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

Negative currency values are shown in bracket in the report

5 Answers 641 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 22 Jul 2018, 06:50 PM

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?

5 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 24 Jul 2018, 03:54 PM
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
0
Simon
Top achievements
Rank 1
answered on 25 Jul 2018, 07:47 PM
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;
0
Accepted
Nasko
Telerik team
answered on 26 Jul 2018, 11:06 AM
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
0
Simon
Top achievements
Rank 1
answered on 26 Jul 2018, 07:54 PM
Hello Nasko,

It works, thanks.
0
Simon
Top achievements
Rank 1
answered on 26 Jul 2018, 07:54 PM
Hello Nasko,

It works, thanks.
Tags
General Discussions
Asked by
Simon
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Simon
Top achievements
Rank 1
Share this question
or