Pass RadGrid DataSource (dataSet)to Telerik Reporting?

5 posts, 0 answers
  1. phelix
    phelix avatar
    25 posts
    Member since:
    Sep 2008

    Posted 02 Oct 2008 Link to this post

    Hi,

    I have a RadGrid  that support sorting and filtering. The RadGrid uses untyped dataset as datasourceWhen user finish sorting and filtering,we want generate a report using the same dataset (with the same sorting order and filter criterial). One way I can think of is pass the dataset to the reporting. But how can I get the sorted and filtered dataset from the RadGrid.
    Another way I think of is pass the sorting field and directions and filter criteria to the reporting and then build the sql statement to retrieve the data for the reporting. And then how can I get the current sorted fields/directions and filtered filedsand values for the RadGrid?

    I personally prefer passing the sorted and filtered datasource(dataset), This way I do not need to query the database again in the report. But I suspect that the datasource(dataset) won't change for the sorting and filtering. The sorting and filtering just affect the presentation layer (how the radgrid shows the data)., isn't it? Or I can pass the dataset and then pass the sorting parms and filtering parms then do the soriting and filtering on the report.

    Any suggestion? Thanks a lot
    -phelix
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 06 Oct 2008 Link to this post

    Hello Phelix,

    Thank you for the detailed explanation.

    Basically, the sort/filter criteria applied by RadGrid will be reflected in the SortExpressions collection/FilterExpression property of the master table.

    Therefore, if you use the same data source for your Telerik reporting instance and define the corresponding ORDERBY and WHERE clauses (based on the values present in the SortExpressions collection/FilterExpression property of the grid) for the SELECT query you execute, you should be able to display the sorted/filtered information in reporting format.

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. phelix
    phelix avatar
    25 posts
    Member since:
    Sep 2008

    Posted 07 Oct 2008 Link to this post

    Hi,Stephen:

    Thanks for the reply.

    Ok, I think I will get the sort and filter criteria and build the where and order by clause for my sql statement.

    But, I have problems when parse the FilterExpression. I found this thread talked about parse the filterexpression,
    https://www.telerik.com/community/forums/thread/b311D-bddkdt.aspx
    but How he got the operator does not sound right.
    Specifically, he used single quote to get the position of operator. This line cause the OpenBrackerPos to be a negative number.
        OpenBracketPos = Conditions.IndexOf("'");

    In my case,I do not have a single quote in my FilterExpression.

    For example, my FilterExpression may look like:
    "(it[\"first_name\"].ToString().StartsWith(\"A\")) AND (Convert.ToString(it[\"zip\"]) <> \"111\")"

    Also, the datatype of zip column is System.String  and why they need to  convert it to string?

    Is there a better way to parse the filterExpression, or should I loop through my RadGridcolumns to get CurrentFilterFunction.ToString() and CurrentFilterValue.ToString() for each column?

    Thanks again
    -phelix



  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 08 Oct 2008 Link to this post

    Hello Phelix,

    Generally, you can invent your own method to parse the FilterExpression data and use it at a later stage to define the WHERE clause of the SELECT query - this depends on your custom logic and grid configuration. Therefore, you can utilize string manipulation using the methods provided by the .NET framework to achieve your goal.

    Further details about how to operate with the FilterExpression property of GridTableView manually you can find in these online resources:

    http://www.telerik.com/help/aspnet-ajax/grdoperatewithfilterexpression.html
    http://www.telerik.com/help/aspnet-ajax/grdapplyingdefaultfilteroninitialload.html

    Alternatively solution can be to iterate the grid columns and extract the CurrentFilterFunction/CurrentFilterValue properties manually as you implied.

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Steve LaForge
    Steve LaForge avatar
    61 posts
    Member since:
    Feb 2005

    Posted 30 Aug 2010 Link to this post

    I have exactly the same need!  This discussion was helpful, or at least I think it is.  I'm about to start on it but this at least let me know that I should be able to achieve my goal.  It would be really awesome if you guys added a demo of doing this!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017