I have application, which uses cs-CZ globalization. Everything is OK, but Kendo grid is not. Problem is in decimal separator in decimal columns. Grid calls my Action method and every sends "." instead of "," as decimal separator. There is my Action method:
ActionResult UpdateProjectEmployee([DataSourceRequest] DataSourceRequest request, Models.ProjectEmployee employee )
{
if (employee != null & ModelState.IsValid)
{
...
My Action method fails (ModelState.IsValid is false), because MVC is not able to create my model, beacuse of decimal separator is "." and Convert methods expect "," because I use cs-CZ globalization. I thing, it is a bug in kendo Grid! I resolved this by using FormCollection instead of my model:
ActionResult UpdateProjectEmployee([DataSourceRequest] DataSourceRequest request, FormCollection data )
{
CultureInfo ci = new CultureInfo("en-US");
Models.ProjectEmployee employee = new Models.ProjectEmployee();
employee.TotalHours = Convert.ToDecimal( data["TotalHours"], ci );
...
But it is not so nice :(
I'm trying to recreate a data grid that I've got working with the old MVC extensions, with the Kendo UI MVC extensions, but the documentation is virtually non-existent. Looking at the example, I've managed to get data into a grid, but it doesn't sort or filter (I'm not sure about apging, as there's only a few records at present.
The view is:-
@(Html.Kendo().Grid<PLCV2.Models.PLCVUser>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.UserName); columns.Bound(p => p.FullName); columns.Bound(p => p.SystemAdmin); columns.Bound(p => p.SystemUser); }) .Pageable() .Sortable() .Scrollable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("AjaxBinding", "UserMgmt")) ))public ActionResult AjaxBinding([DataSourceRequest] DataSourceRequest request) { Models.PLCVdBDataContext db = new Models.PLCVdBDataContext(); var query = from p in db.PLCVUsers select p; //query = query.OrderByDescending(c => c.UserName); return Json(query.ToDataSourceResult(request),JsonRequestBehavior.AllowGet); }
How do I enable sorting and filtering?
Also, I had to add the AllowGet JsonRequestBehaviour, to get the grid to work. Your examples don't seem to require this - how?
Where is the documentation for the MVC extensions? I can only find a very brief (and very lacking!) migration overview, which fails to mention many of the server-side changes (no GridAction, the new DataSourceRequest etc..).
I'm keen to try out the new extensions, but without more documentation, it doesn't seem feasible.
treeview.append({text: "New text",value: "Value",url: "/dummyUrl"});Heres the script for opening the dialog:@(Html.Kendo().Window() .Name("createProjectDialog") .Animation(c => c.Open(builder => builder.Zoom(ZoomDirection.In).Duration(AnimationDuration.Slow)) .Close(builder => builder.Zoom(ZoomDirection.Out).Duration(AnimationDuration.Slow) ).Enable(true)) .Title("Create New Project") .LoadContentFrom("Create", "Projects") .Modal(true) .Draggable(true) .Width(650) .Visible(false))
$("#newProjectbtn").bind("click", function () { $("#createProjectDialog").data().kendoWindow.open(); });