FilterExpression Error

9 posts, 2 answers
  1. Iosu Buenetxea
    Iosu Buenetxea avatar
    91 posts
    Member since:
    Jan 2008

    Posted 21 Oct 2008 Link to this post

    Hello

    I trying to put a filter expression on my item command, I set my filterExpression like http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.gridtableview-filterexpression.html.


    I have this code:
    Dim column As GridColumn = rgWorkflow.MasterTableView.GetColumnSafe("Denominacion")  
                column.CurrentFilterFunction = GridKnownFunction.Contains  
                column.CurrentFilterValue = TryCast(TryCast(rgWorkflow.MasterTableView.GetItems(GridItemType.FilteringItem)(0),  _  
                        GridFilteringItem)("Denominacion").Controls(0), TextBox).Text  
                If Not column.CurrentFilterValue = String.Empty Then 
                    rgWorkflow.MasterTableView.FilterExpression = "([Denominacion] LIKE '%" & column.CurrentFilterValue & "%') " 
                    'rgWorkflow.MasterTableView.FilterExpression = "[Denominacion like '%" & column.CurrentFilterValue & "%']"  
                End If 

    I execute this code when the user do click in a imagebutton that I put in my FilteringItem, later in final of the ItemCommand I fill a datasource to the RadGrid and do databind.

    When I do databind to the control, the application throws a PageRequestManagerServerErrorException: Expression expected.

    Thanks.
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Oct 2008 Link to this post

    Hello JUAN,

    Please set EnableLinqExpressions to false to avoid this.

    Sincerely yours,
    Vlad
    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. Iosu Buenetxea
    Iosu Buenetxea avatar
    91 posts
    Member since:
    Jan 2008

    Posted 22 Oct 2008 Link to this post

    Hi Vlad

    With this property to false I can filter manually.

    One more question, How can I put filter expression in more columns?

    Thanks,
  5. Answer
    Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Oct 2008 Link to this post

    Hi JUAN,

    Consider concatenating the elements of the WHERE clause (which is reflected in the FilterExpression property of the master table) with 'AND' words in the same way as you will do that with DataView.Filter. Review the following article from the documentation for more details:

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

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Mike Nogen
    Mike Nogen avatar
    34 posts
    Member since:
    May 2006

    Posted 22 Jan 2009 Link to this post

    Hello!

    I have read a lot of post where the solution is to turn of the linqexpression. What If I need to have it set to true and want to use "Applying default filter on initial load". I have read

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

    Where you say

    "manually in code should conform to the LINQ expression syntax instead of the old T-SQL syntax. Only thus they will be evaluated properly by the control."

    Could you please give an example of syntax when using

     

    EnableLinqExpressions="true" 

    and how to use 

     

    RadGrid1.MasterTableView.FilterExpression =

     

    on 

     

    Page_Load

     

     

     

  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Jan 2009 Link to this post

    Hi Mike,

    Review the code from the PageLoad handler in this online demo and let us know whether this helps.

    Best regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Mike Nogen
    Mike Nogen avatar
    34 posts
    Member since:
    May 2006

    Posted 22 Jan 2009 Link to this post

    Thank´s, I found another way also. It was by debugging the Selecting event of the Linqdatasource and see the current filter expression where I found my solution.

     

    //Filter on last import on default Page_load on export
    //My own custom functions  
    ReportPeriod reportPeriod = new ReportPeriod();  
    string LastReportPeriod = reportPeriod.GetLastReportPeriod();  

    //Set the manual Linq filter expression to the radgrid
    RadGrid1.MasterTableView.FilterExpression = string.Format("(iif(ReportPeriod == null, \"\", ReportPeriod).ToString().ToUpper().Contains(\"{0}\".ToUpper()))", LastReportPeriod);  

    //Get the Colum within the radGrid
    GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("ReportPeriod");  
    column.CurrentFilterFunction = GridKnownFunction.Contains;  

    //Set the filter value into the filter box in the column
    column.CurrentFilterValue = LastReportPeriod

     

     

  9. pluc
    pluc avatar
    5 posts
    Member since:
    Feb 2007

    Posted 04 Mar 2010 Link to this post

    Hi,

    What does  "it" in "it.CustomerID = ALFKI"; mean?

    Is it the DetailTableName?  If Yes, what name has the MasterTableView? 

    Thank you.


  10. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 04 Mar 2010 Link to this post

    Hello kzimny,

    "it" stands for the grid item(s) that matches the criteria. This not RadGrid specific and comes from the LINQ syntax used under ASP.NET 3.5.

    Regards,
    Sebastian
    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
UI for ASP.NET Ajax is Ready for VS 2017