I am using ASP MVC 5, Razor syntax, the Telerik HTML Helpers and the latest Kendo UI tools.
I would like to create an AutoComplete search box that pops up a Window with a Grid of the search results in it.
I have code that works for the AutoComplete box:
I have a Partial View that displays the search results in a Grid.
I cannot figure out how to define the Window and wire it up properly.
Here's what I have for the Window:
Any help you can give me showing how to wire up these three controls (AutoComplete, Grid, Window) would be appreciated.
Thanks,
Simon
I would like to create an AutoComplete search box that pops up a Window with a Grid of the search results in it.
I have code that works for the AutoComplete box:
@(Html.Kendo().AutoComplete()
.Name(
"mySearchBox"
)
.MinLength(3)
.DataTextField(
"Description"
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"AutoComplete"
,
"Home"
)
.Data(
"getAutoCompleteValue"
);
}).ServerFiltering(
true
);
})
)
<script type=
"text/javascript"
>
function getAutoCompleteValue() {
//alert("frak me");
return
{ term: $(
"#mySearchBox"
).val() };
}
</script>
I have a Partial View that displays the search results in a Grid.
@
using
Experiment6.Web.Models.Home;
@model IQueryable<SearchResult>
<div id=
"searchResultsList"
role=
"grid"
class
=
"panel panel-body"
>
@
if
(Model.Count() != 0)
{
<div><h3>Search Results</h3></div>
@(Html.Kendo()
.Grid<Experiment6.Web.Models.Home.SearchResult>()
.Name(
"Grid"
)
.DataSource(datasource => datasource .Ajax() .Read(read => read .Action(
"GetSearchResults"
,
"Home"
) .Data(
"getAutoCompleteValue"
)))
.Pageable(p => p.ButtonCount(5))
.Sortable()
)
}
</div>
I cannot figure out how to define the Window and wire it up properly.
Here's what I have for the Window:
@(Html.Kendo().Window()
.Name(
"searchWindow"
)
.Title(
"Search Results"
)
.Visible(
true
)
.Actions(x => x.Close())
//Neither of these work:
//.Content(Html.Partial("_SearchResults", Model.SearchResults))
//.LoadContentFrom("ShowSearchResultsAjax", "Home", "getAutoCompleteValue"))
)
Any help you can give me showing how to wire up these three controls (AutoComplete, Grid, Window) would be appreciated.
Thanks,
Simon