Hello,
I am trying to achieve the following scenario.
1.) Use enters the search term
2) Click search button
3) Loads the Partial View of Results Grid, (Asynchronously loading the results)
I am able to load data in the using server binding. (Passed all results in the model). I am hard time to achieve the same using Ajax data source binding. The results would load (Ajax Read operation is not invoked on the Grid)
Below is my partial view 'QueryProspects.cshtml'
I am trying to achieve the following scenario.
1.) Use enters the search term
2) Click search button
3) Loads the Partial View of Results Grid, (Asynchronously loading the results)
I am able to load data in the using server binding. (Passed all results in the model). I am hard time to achieve the same using Ajax data source binding. The results would load (Ajax Read operation is not invoked on the Grid)
Below is my partial view 'QueryProspects.cshtml'
@model string
@(Html.Kendo().Grid<
SampleDataSummaryDto
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(l => l.Id).Title("Name");
columns.Bound(p => p.CompanyName).Title("Company Name");
columns.Bound(p => p.PhoneNumber).Title("Phone");
columns.Bound(p => p.EmailAddress).Title("Email");
})
.HtmlAttributes(new { style = "height:450px" })
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("SearchResults_Read", "Prospect", new { SearchText = Model }))
)
)
public PartialViewResult loadSampleData(string SearchText)
{
return PartialView("EditorTemplates/loadSampleData", SearchText);
}
public ActionResult SearchResults_Read(string SearchText)
{
var results= myService.GetByIdentifiers(SearchText, 20);
var dsResult = results.ToDataSourceResult(new DataSourceRequest());
return Json(dsResult);
}
I am passing the searchText to partial view and thinking that my Grid view use that search text asynchronously would call 'SearchResults_Read' and passing the SearchText as action param.
I appreciate any suggestions on why this is not working?
Thank You,
Uday