locked
LightSwitch (Silverlight) DataGrid + WCFRIA : How to get the DataGrid Search box to work on a WCFRIA resultset? RRS feed

  • Question

  • Hi All,

    I'm using WCFRIA for a certain result set and the results are being shown in the DataGrid. But the default search box that comes with the grid does not seem to be working with WCFRIA data. When anything is typed in that box then no data is returned. 

    I opened up Fiddler and saw that the HTTP GET request is adding a _search parameter to the existing list of parameters that are being passed to the RIA service query but I am not aware of how to get a handle on this parameter in my service. Also I'm not sure if I need to handle this part myself or I just need to tweak some config option to enable this?

    I wouldn't mind handling the search myself if needed if only I were able to access the _search string being passed, but I don't know how.

    Any help on this would be appreciated!

    Thanks in advance!

    Jayesh

    Friday, February 14, 2014 6:22 PM

Answers

  • I never got back to closing this, I figured the issue I was facing on this one. So search works on RIA services, only the search is case sensitive. I wasn't expecting this, because search on MS SQL Server is case insensitive, but I realized that this was a SQL Server setting and nothing to do with RIA/LightSwitch.

    So I figured out how to make search on RIA services case insensitive as well. In a nutshell, one needs to override the Query method in the RIA and then change the IQueryable queryDescription.Query by digging into the underlying Expressions and changing "Contains" to "IndexOf" along with OrdinalIgnoreCase.

    This is where I got the idea from: http://stackoverflow.com/questions/5305526/can-linq-expression-be-case-insensitive

    • Marked as answer by JayeshK Monday, July 21, 2014 9:36 PM
    Monday, July 21, 2014 9:36 PM

All replies

  • Hi Jayesh

    According to your description above, no data is returned when you type something in search box. I'm guess whether you bind the datagrid properly, you coudl check it on your side.

    In addition, I'd also like to suggest you to learn the general way using the Silverlight DataGrid With LightSwitch, and using WCF RIA Services In LightSwitch .

    If it still has same issue, please let me know.

    Best regards

    Angie Xu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Edited by Angie Xu Tuesday, February 18, 2014 7:11 AM
    Tuesday, February 18, 2014 7:06 AM
  • Angie, thanks for your reply and the links.

    However, neither of the links you suggested show how to use the default search box ( available with the LS datagrid ) with a RIA service that LightSwitch is consuming as a datasource. I do not need to do any separate binding in my app since LS consumes RIA services as a datasource and exposes the queries to use in my screens (just like a SQL Server data source). Also, I am not adding the silverlight datagrid directly ( as a custom control ) so I shouldn't need to worry about that. (I do know that LightSwitch is internally using the Silverlight DataGrid). 

    My problem is that the search box available with the LS DataGrid is not filtering the results returned by my RIA service and I want to figure out how to do this.

    Thanks!

    Jayesh

    Tuesday, February 18, 2014 2:08 PM
  • I never got back to closing this, I figured the issue I was facing on this one. So search works on RIA services, only the search is case sensitive. I wasn't expecting this, because search on MS SQL Server is case insensitive, but I realized that this was a SQL Server setting and nothing to do with RIA/LightSwitch.

    So I figured out how to make search on RIA services case insensitive as well. In a nutshell, one needs to override the Query method in the RIA and then change the IQueryable queryDescription.Query by digging into the underlying Expressions and changing "Contains" to "IndexOf" along with OrdinalIgnoreCase.

    This is where I got the idea from: http://stackoverflow.com/questions/5305526/can-linq-expression-be-case-insensitive

    • Marked as answer by JayeshK Monday, July 21, 2014 9:36 PM
    Monday, July 21, 2014 9:36 PM