sorting detail section programmatically

5 posts, 0 answers
  1. njtech
    njtech avatar
    5 posts
    Member since:
    Jul 2006

    Posted 25 Oct 2010 Link to this post

    With the new Q2 release Telerik Reports hyperlinks are now supported,
    and I am trying to enable interactive sorting without tables. Table
    performance seems very slow or even hangs  when using table grouping.

    With the fields in the detail section directly, and  using the NeedDataSource, or ItemDataBinding(for the report details section)  event I can grab my report params but in these events the sorting methods don't work. "Telerik.Reporting.Data.SortDirection.Asc"

    The sorting does work under InitializeComponet() but
    I can't get the params or at least don't know how at that stage of
    report rendering. .

    I am designing the reports in a class library  

    Thanks

    Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
     
               if ((string)report.Parameters["SortDir"].Value == "Asc")
               {
     
                   this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                   
                    
               }

    private void Report3_NeedDataSource(object sender, EventArgs e)
            {

                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

                if ((string)report.Parameters["SortDir"].Value == "Asc")
                {

                    this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                    report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }




    private void Report3_NeedDataSource(object sender, EventArgs e)
            {

                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

                if ((string)report.Parameters["SortDir"].Value == "Asc")
                {

                    this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                    report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
           
    private void Report3_NeedDataSource(object sender, EventArgs e)
            {

                 report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }
    private void Report3_NeedDataSource(object sender, EventArgs e)
            {

                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

                if ((string)report.Parameters["SortDir"].Value == "Asc")
                {

                    this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                    report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
           {

                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

                if ((string)report.Parameters["SortDir"].Value == "Asc")
                {

                    this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                    report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }
    private void Report3_NeedDataSource(object sender, EventArgs e)
            {

                Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

                if ((string)report.Parameters["SortDir"].Value == "Asc")
                {

                    this.Sorting.Add(new Sorting("firstname", Telerik.Reporting.Data.SortDirection.Asc));
                    report.DataSource = this.sqlDataSource1;
                    
                }
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }
  2. Scott McNeany
    Scott McNeany avatar
    9 posts
    Member since:
    Mar 2010

    Posted 26 Oct 2010 Link to this post

    I am also looking for a way to pass Sort Direction as a parameter. Can it be done in the table's ItemDataBinding event handler?
  3. DevCraft banner
  4. njtech
    njtech avatar
    5 posts
    Member since:
    Jul 2006

    Posted 26 Oct 2010 Link to this post

    Yes it can there are examples in other posts on that.

    I am not using tables and trying to get it to work,
    by just dropping fields in the detail section. 

    Larry
  5. Lawrence
    Lawrence avatar
    1 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    Seemed to have figured this out. Using the main report's ItemDataBindingEvent
    grab the parameters and set the sorting as needed. Set the sorting of the main report
    using a function = Fields(Parameters.SortBy.Value) 
    private void TheReport_ItemDataBinding(object sender, EventArgs e)
           {
              
     
               if (((string)this.ReportParameters["SortDir"].Value) == "Asc")
               {
     
                    this.Sorting[0].Direction = Telerik.Reporting.Data.SortDirection.Asc;
               }
               else
               {
                   this.Sorting[0].Direction = Telerik.Reporting.Data.SortDirection.Desc;
               }
     
           }
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Oct 2010 Link to this post

    Hi guys,

    @Scott: check the following forums:
    @Larry: You can't access report parameters in the report constructor because they are not set until after the instance is created. This is not something specific to Telerik Reporting, but applicable for any .NET class. Check out the above threads if you haven't yet and see how the sorting is implemented for the Table item. The same approach is applicable for any report data item including the report.

    In fact we're working on something similar for the upcoming Q3 release that would be out of the box feature, so stay tuned :)

    Greetings,
    Steve
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner