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

Parameter and groups

1 Answer 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dalibor
Top achievements
Rank 1
Dalibor asked on 06 Mar 2014, 06:43 AM
hi,

i have the following situation, working report with some input parameters and defined groups in report.
When i add new parameter on report, code for my groups in designer.cs file disappears. When i try access them in code they always trow null Exception.
I have some code in report  ItemDataBinding event for group manipulation.

example:

if (!string.IsNullOrWhiteSpace((string)ReportParameters["DatumOd"].Value) && !string.IsNullOrWhiteSpace((string)ReportParameters["DatumDo"].Value))
            {
                this.group2.Groupings.Clear(); 
                this.group2.Groupings.AddRange(new Telerik.Reporting.Grouping[] { new Telerik.Reporting.Grouping("=Fields.Sifra") });
                //this.group2.Sortings.AddRange(new Telerik.Reporting.Sorting[] { new Telerik.Reporting.Sorting("=", Telerik.Reporting.SortDirection.Asc) });
                this.groupFooterSection2.Visible = false;
            }
            else if (!string.IsNullOrWhiteSpace((string)ReportParameters["RazdobljeOd"].Value) && !string.IsNullOrWhiteSpace((string)ReportParameters["RazdobljeDo"].Value))
            {
                this.group2.Groupings.Clear();
                this.group2.Groupings.AddRange(new Telerik.Reporting.Grouping[] { new Telerik.Reporting.Grouping("=Fields.Razdoblje") });
                //this.group2.Sortings.AddRange(new Telerik.Reporting.Sorting[] { new Telerik.Reporting.Sorting("=", Telerik.Reporting.SortDirection.Asc) });
            }

1 Answer, 1 is accepted

Sort by
0
Hinata
Top achievements
Rank 1
answered on 10 Mar 2014, 04:19 PM
Hi Dalibor,

I believe that if you move all of your custom code from the Designer.cs to the report constructor you will be fine. You can do the same for the code in the ItemDataBinding event, since I'm not sure an event is the correct place to do the grouping. For more information you can always read the reporting online help.
Tags
General Discussions
Asked by
Dalibor
Top achievements
Rank 1
Answers by
Hinata
Top achievements
Rank 1
Share this question
or