or
@using (Ajax.BeginForm("UpdateSearchCriteria", "Home", new AjaxOptions() { HttpMethod = "post", OnSuccess = "Update" }))
{
@(Html.Kendo().DatePickerFor(model => model.Criteria.StartDate)
.Min(new DateTime(1900, 1, 1)) //Set min date of the datepicker
.Max(new DateTime(2099, 12, 31)) //Set min date of the datepicker
)
@(Html.Kendo().DatePickerFor(model => model.Criteria.EndDate)
.Min(new DateTime(1900, 1, 1)) //Set min date of the datepicker
.Max(new DateTime(2099, 12, 31)) //Set min date of the datepicker
)
@(Html.Kendo().IntegerTextBoxFor(model => model.Criteria.Number).Min(1))
@(Html.Kendo().AutoCompleteFor(model => model.Criteria.CityName)
.Filter("contains")
.MinLength(3)
.BindTo(Common.Helpers.CityHelper.GetCityNames())
.HighlightFirst(true)
.IgnoreCase(true)
)
<
input
type
=
"submit"
value
=
"Search!"
/>
}
@(Html.Kendo().Grid<
Models.SearchResult
>()
.Name("SearchResultDataGrid")
.Columns(columns =>
{
columns.Bound(p => p.Property.PropertyName).Title("Property");
columns.Bound(p => p.Range).Title("Range");
columns.Bound(p => p.Number).Title("Number");
})
.Sortable()
.Scrollable()
.AutoBind(false)
.BindTo(Model.SearchResult)
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("Search", "Home")) // Set the action method which will return the data in JSON format
)
)
<
script
>
function Update(response, status, data) {
var grid = $("#SearchResultDataGrid").data("kendoGrid");
grid.dataSource.read();
}
</
script
>
public ActionResult UpdateSearchCriteria(Screen iModel)
{
return Json(iModel);
}
[HttpPost]
public ActionResult Search(Screen iModel)
{
[...]
return Json(theDataSourceRS);
}
Dim dropDownListFor = _htmlHelper.Kendo().DropDownListFor(Of Integer)(_expression) _
.BindTo(New SelectList(_collectionValeur, "Id", "Name")) _
.HtmlAttributes(_attributsHtml)
1.
public
ActionResult ViewDetails(
long
[] contactId)
2.
{
3.
ViewData[
"contactId"
] = contactId;
4.
return
View();
5.
}
01.
@{
02.
ViewBag.Title = "ViewDetails";
03.
Layout = "~/Views/Shared/_Layout.cshtml";
04.
}
05.
06.
<
h2
>ViewDetails</
h2
>
07.
08.
09.
@(
10.
11.
@Html.Kendo().Grid<
DetailGridViewModel
>()
12.
.Name("Grid")
13.
.Columns(columns =>
14.
{
15.
columns.Bound(p => p.ContactId).Hidden();
16.
columns.Bound(p => p.ContactNumber);
17.
columns.Bound(p => p.ContactName);
18.
columns.Bound(p => p.Date).Width(130).Format("{0:d}");
19.
columns.Bound(p => p.ContactStatus);
20.
columns.Bound(p => p.Type);
21.
columns.Command(command =>
22.
{
23.
24.
}).Width(200);
25.
26.
})
27.
28.
29.
.Sortable( )
30.
.Resizable(resize => resize.Columns(true))
31.
.Filterable()
32.
.DataSource(dataBinding =>
33.
dataBinding.Ajax().Aggregates(agg => { agg.Add(com => com.Value).Sum();
34.
agg.Add(p => p.ContactCost).Sum();
35.
}).Read(read => read.Action("_SelectDetails", "Contacts").Data(obj => new {contactId = ViewData["contactId"]}))))
36.
01.
public
ActionResult _SelectDetails([DataSourceRequest] DataSourceRequest request,
long
[] contactId)
02.
{
03.
List<DetailGridViewModel> finalList =
new
List<DetailGridViewModel>();
04.
foreach
(var conId
in
contactId)
05.
{
06.
var con = _contactService.GetContactById(conId);
07.
IEnumerable<DetailGridViewModel> coms = con.Select(x =>
new
DetailGridViewModel(x));
08.
finalList.AddRange(coms);
09.
}
10.
11.
return
Json(finalList.ToDataSourceResult(request));
12.
}
@model string
@using System.Collections
<
div
style
=
"white-space:nowrap;"
>
@Html.TextBoxFor(m => m, new { onclick = "setInvisible(\"SplitCountryList#=Rid#\")", onfocus = "setInvisible(\"SplitCountryList#=Rid#\")", id = "CoPrefSplit#=Rid#" })
<
button
id
=
"SplitCountryDisplay"
onclick
=
"setVisibleAndFocus('\\#SplitCountryList#=Rid#','\\#SplitCountryCombo-input')"
style
=
"background-color:White; width: 20px; height:22px; font-size: 6pt"
>...</
button
>
</
div
>
<
div
id
=
"SplitCountryList#=Rid#"
style
=
"position: absolute; overflow:visible; width:250px; z-index:99; margin-top: 0px; visibility:hidden;"
>
@(Html.Kendo().ComboBoxFor(m => m)
.Name("SplitCountryCombo#=Rid#")
.BindTo(new SelectList((IEnumerable)ViewData["Countries"], "Code", "DisplayName"))
.HtmlAttributes(new {@ArticleID = "#=Rid#"})
.Filter(FilterType.Contains)
.Events(events => events
.Change("onSplitCountryChanged")
)
)
</
div
>
Unable to get property 'length' of undefined or null reference kendo.web.min.js, line 10 character 28275
@(Html.Kendo().Grid<
Fluid
>()
.Name("Grid")
.Columns(columns => {
columns.Bound(o => o.FluidID).Groupable(false);
columns.Bound(o => o.Name);
columns.Bound(o => o.Code);
columns.Bound(o => o.Grade);
columns.Bound(o => o.Manufacturer);
})
.Deferred()
.Pageable()
.Sortable()
.Filterable()
.Scrollable()
.Groupable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetJsonData", "FluidKendo"))
)
)
public
ActionResult GetJsonData([DataSourceRequest] DataSourceRequest request)
{
List<Fluid> allFluids = MockFluids();
// When drag column header into group by row the following JavaScript error occurs
// JavaScript error IE: SCRIPT5007: Unable to get property 'length' of undefined or
// null reference kendo.web.min.js, line 10 character 28275
// JavaScript error Chrome: Uncaught TypeError: Cannot read property 'length' of undefined
// --- Example taken from the Custom AJAX Binding example: CustomAjaxBindingController.cs
var resultThatErrors =
new
DataSourceResult();
resultThatErrors.Data = allFluids;
resultThatErrors.Total = allFluids.Count();
return
Json(resultThatErrors);
}
.GroupFooterTemplate( f =>
"Sum: "
+ f.Sum )
.Aggregates( a => a.Add(c => c.Quantity).Sum())