We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Searching with Entity Framework

Hello,

Iam using Grid with CRUDURL and loading Data with DataManager.
How to realize a dynamic search over all Columns?

Thanks

2 Replies

AR Arthur June 6, 2016 10:20 AM UTC

If I use this as Datasource, searching is working:
.Datasource((IEnumerable<Mitarbeiter>)ViewBag.datasource2)

But I also want to Edit the Grid, so i changed it to:
.Datasource(ds=>ds.URL("Mitarbeiter/LoadData").CrudURL("Mitarbeiter/CrudUpdate").Adaptor(AdaptorType.UrlAdaptor)).AllowPaging()

Now i can not really search, because i have to pass dynamicly the search Columns to Entity Framework, what is not working.

Can I combine the Datasource Expression??? Like this:
.Datasource(ds=>ds.URL("Mitarbeiter/LoadData").CrudURL("Mitarbeiter/CrudUpdate").Adaptor(AdaptorType.UrlAdaptor)).AllowPaging().Datasource((IEnumerable<Mitarbeiter>)ViewBag.datasource2)

Thanks


JK Jayaprakash Kamaraj Syncfusion Team June 7, 2016 11:45 AM UTC

Hi Arthur, 

Thank you for contacting Syncfusion support. 

While using UrlAdaptor, we need to handle grid operation(filtering/searching/sorting) in server side. Please refer to the below knowledgebase document, help document, code example and sample. 


GridFeatures.cshtml 
@(Html.EJ().Grid<object>("FlatGrid") 
            .Datasource(ds => ds.URL("/Grid/DataSource").CrudURL("/Grid/CrudUpdate").Adaptor(AdaptorType.UrlAdaptor)) 
        })) 
GridController.cs 
public ActionResult DataSource(DataManager dm) 
        { 
             
 
           if (dm.Search != null && dm.Search.Count > 0) //searching 
            { 
                result.result = operation.PerformSearching(DataSource, dm.Search); 
            } 
            .. 
 
           return Json(result, JsonRequestBehavior.AllowGet); 
        } 


Regards, 

Jayaprakash K. 


Loader.
Up arrow icon