Hi,
I was hoping someone could help me with the issue I have in storing the order of sortable panels within the local storage.
Here is some example code I am using:
-----------------------------------------------------------------------------------------
.........
string name = string.Format("main-content{0}", colCounter);
<div id = "@name" >
@{
foreach (var colItem in cols)
{
@renderTiles(colItem);
}
}
</div>
..................
@(Html.Kendo().Sortable()
.For("#main-content1")
.ConnectWith("#main-content2,#main-content3")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
@(Html.Kendo().Sortable()
.For("#main-content2")
.ConnectWith("#main-content1,#main-content3")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
@(Html.Kendo().Sortable()
.For("#main-content3")
.ConnectWith("#main-content1, #main-content2")
.Cursor("move")
.PlaceholderHandler("placeholder")
.HintHandler("hint")
)
.............
<script>
var localStorageSupport = (('localStorage' in window && window['localStorage'] !== null)),
data,
html;
if (localStorageSupport) {
data = JSON.parse(localStorage.getItem("sortableData"));
} else {
alert("your browser does not support local storage");
}
$(document).ready(function ()
{
$('.widget').click(function (e) {
window.location.href = $(e.target).attr('href');
})
$('.widget').change(function (e) {
var item = data.splice(e.oldIndex, 1)[0];
data.splice(e.newIndex, 0, item);
localStorage.setItem("sortableData", kendo.stringify(data))
})
})
</script>
@helper renderTiles(IPublishedContent Section)
{
var title = Section.GetPropertyValue<string>("tiitle", String.Empty);
var icon = Section.GetPropertyValue<string>("icon", String.Empty);
int intLink = Section.GetPropertyValue<int>("intLink", 0);
var extLink = Section.GetPropertyValue<string>("extLink", String.Empty);
var imgId = Section.GetPropertyValue("icon", -1);
var Url = string.Empty;
if (@intLink == 0 && @extLink.Length > 0)
{
Url = @extLink;
}
else if (@intLink != 0 && @extLink.Length == 0)
{
Url = Umbraco.NiceUrl(@intLink);
}
<div id="panes" class="widget" header="@title" href="@Url">
<div header="@title" href="@Url">
@title
<div class="widget-image" header="@title" href="@Url">
@if (imgId != -1)
{
<img src="@Umbraco.TypedMedia(imgId).Url" alt="=@Umbraco.TypedMedia(imgId).Name" title="@title" header="@title" href="@Url" />
}
</div>
</div>
</div>
}
I have looked at the following:
http://docs.telerik.com/kendo-ui/controls/interactivity/sortable/overview
http://docs.telerik.com/kendo-ui/controls/interactivity/sortable/how-to/persist-order-in-localstorage
http://www.telerik.com/forums/saving-sortable-state
These do make sense but I am having a bit of a senior moment with what I am trying to do.
Many thanks.
J
@model IEnumerable<HCS.Model.FinancialInstitution>@(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns.Bound(p => p.MainRT).Groupable(false); columns.Bound(p => p.LegalName); }) .Pageable() .Sortable() .Scrollable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .ServerOperation(false)))@model IEnumerable<HCS.Model.FinancialInstitution>@(Html.Kendo().Window() .Name("window") .Title("Choose a Financial Institution (FI)") .Content(() => { @Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns.Bound(p => p.MainRT).Groupable(false); columns.Bound(p => p.LegalName); }) .Pageable() .Sortable() .Scrollable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .ServerOperation(false)); }) .Draggable() .Resizable() .Events(ev => ev.Close("onClose")) .Width(400) )
I am unable to figure out why the HttpPostedFileBase is always null in my upload widget. Sample Project showing the issue.
View
@using (Html.BeginForm()){ @Html.AntiForgeryToken() <div class="row row-spacing-bottom"> <div class="col-md-12"> @(Html.Kendo().Upload() .Name(Html.IdFor(model => model.HttpPostedFileBase).ToString()) .Multiple(false) .Messages(m => m.Select("Select a File")) .Events(e => e.Select("uploadHelper.checkFileSize")) .Deferred()) </div> </div> <div class="row"> <div class="col-md-12"> @(Html.Kendo().Button() .Name("Submit") .Content("Upload File") .HtmlAttributes(new {type = "submit"}) .Deferred()) </div> </div>}
Controller:
public class FileUploadController : Controller { public ActionResult FileUpload() { return View(); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult FileUpload(Models.FileUpload fileUpload) { var result = fileUpload.HttpPostedFileBase != null; return Json(new {success = result}); } }
Submit function:
$('form').submit(function () { layout.showLoadingScreen(true); $.ajax({ url: this.action, type: this.method, data: $(this).serialize(), success: function (result) { if (result.success) { layout.showNotification("Save Successful", "success"); layout.showLoadingScreen(false); } else { layout.showNotification("Error Saving Record", "error"); layout.showLoadingScreen(false); } } }); return false; });
Hello guys.
Unfortunately, I've found an error in Kendo (there is no such error in 2015.3.930.545 (just for information))
Check the example project.
https://www.dropbox.com/s/7h8gm1ekyui56qq/KendoUI.rar?dl=0
Description:
- I have two grids.
- They both have a field "Volume" and calculate the sum of this field.
- They don't have any other aggregates for other fields. (it's important)
What I have:
1) Static class "ClassFactory" ("~/Infrastructure/Implementation/ClassFactory.cs") which has a variable Dictionary<Signature, Type> classes.
2) Class "Signature" ("~/Infrastructure/Implementation/Signature.cs") that has a method "Equals"
3) ArgumentException
Description:
When one of grid sends a request to controller, some manipulations are performed and we find ourselves in "ClassFactory" in a method "GetDynamicClass". Here a variable (name - signature) of type "Signature" is added to the variable "classes" of type "Dictionary<Signature, Type>". No problems, everything is fine. Then another grid does the same steps. But now, when the variable "signature" is being added to the variable "classes", I get exception "ArgumentException". Why? Look at the code of the method "Equals" of the class 'Signature':
if (poperties.Length != other.properties.Length) return false;
for (int i = 0; i < properties.Length; i++)
{
if (properties[i].Name != other.properties[i].Name || properties[i].Type != other.properties[i].Type)
return false;
}
return true;
Aggregates for the first grid: Sum_Volume for the field "Volume"
Aggregates for the second grid: Sum_Volume for the field "Volume"
Conclusion:
Aggregates are the same, so the method "Equals" returns true
And that's why I get "ArgumentException" (An item with the same key has already been added)
Solution:
People who have the same error:
You can:
1) Add the hidden field to the grid (to the model) and aggregate sth (for ex: sum) for this field. (if you have more than 2 grids with such problem, don't forget that these hidden fields must have different names, otherwise it won't help)
2) You can rename a field in one of the grids
3) Wait until Kendo fixes it :)
4) Maybe someone has another idea?!

I have the following code. i was able to determine the click on a row. but cant get the popup form to open when the row is selected.
@(Html.Kendo().Grid<grid.Model.entity>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.phone).Title("Phone").HeaderHtmlAttributes(new { style = "font-size:13px;" });
columns.Bound(p => p.address).Title("Home Address").HeaderHtmlAttributes(new { style = "font-size:13px;" });
columns.Bound(p => p.email).Title("Email").HeaderHtmlAttributes(new { style = "font-size:13px;" });
})
.ToolBar(toolbar =>
toolbar.Create()
)
.Editable(ed => ed.Mode(GridEditMode.PopUp))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:730px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(30)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ID))
.Create(update => update.Action("EditingPopup_Create", "Welcome"))
.Read(read => read.Action("Info", "Welcome").Data("searchText"))
.Update(update => update.Action("EditingPopup_Update", "Welcome"))
)
.Resizable(resize => resize.Columns(true))
)
<script type="text/javascript">
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
$('table').click(function () {
var grid = $("#grid").data('kendoGrid');
grid.select().each(function () {
// how to open the form from here?
})
});
</script>

Hi,
We are using Kendo Data Grid, we are trying to edit the record that will go to a new page (cshtml) and passing a parameter like the ID.
Below is the code but it is not working at all. Please advise, TIA.
index.cshtml
@(Html.Kendo().Grid<iOneDistribution.Web.Models.Users.UserViewModel>()
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(u => u.UserCode))
.Read(read => read.Action("Users_Read", "Users"))
.Update(update => update.Action("Update", "Users"))
)
.Columns(columns =>
{
columns.Command(c => c.Edit());
columns.Bound(c => c.UserCode);
columns.Bound(c => c.Acronym);
columns.Bound(c => c.IsActive);
columns.Bound(c => c.IsAllowApprove);
columns.Bound(c => c.DefaultCulture);
})
.Pageable()
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.SingleColumn);
})
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("_UserEdit"))
.Filterable()
.Scrollable()
)
for the _useredit.cshtml
@model iOneDistribution.Web.Models.Users.UserViewModel
<h3>Customized Person edit template</h3>
<br />
@Html.HiddenFor(model => model.UserCode)
<div>
@Html.LabelFor(model => model.Name)
</div>
<div>
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div>
@Html.LabelFor(model => model.UserGroupCode)
</div>
<div>
@*@Html.Kendo().DateTimePickerFor(model => model.BirthDate)
@Html.ValidationMessageFor(model => model.BirthDate)*@
</div>

I have implemented some server-side validation to prevent overlaps from occurring, but if an event fails twice in a row, it disappears entirely from the scheduler.
My scheduler is as follows:
@(Html.Kendo().Scheduler<MyEventViewModel>() .Name("Scheduler") .Date(DateTime.Today) .StartTime(DateTime.Today.AddHours(8)) .Height(500) .Views(v => { v.DayView(); v.WeekView(); v.CustomView("TwoWeekView"); }) .Group(g => { g.Resources("Labour"); g.Date(true); }) .Resources(resources => resources .Add(m=>m.LabourId) .Name("Labour") .Title("Labour") .DataValueField("Id") .DataTextField("FullName") .DataSource(dataSource => dataSource .Read(read => read .Action("LabourResourcesList", "Scheduler") .Type(HttpVerbs.Post) .Data("LabourResourceSelection") ) .Events(e=>e.Change("RefreshSchedulerView")) ) ) .DataSource(dataSource => dataSource .Read(read => read .Action("ScheduledEvents", "Scheduler") .Type(HttpVerbs.Post) .Data("LabourResourceSelection") ) .Update("UpdateSchedule","Scheduler") .Model(m => { m.Field(f => f.Id); m.Field(f => f.LabourId); m.Field(f => f.Start); m.Field(f => f.End); m.Field(f => f.Description); m.Field(f => f.JobCode); m.Field(f => f.Title); }) .Custom() .Type("aspnetmvc-ajax") .Schema(schema => schema.Model(model => { model.Id(f => f.Id); model.Field(f => f.LabourId); model.Field("title", typeof(string)).From("Description"); model.Field("start", typeof(DateTime)).From("Start"); model.Field("end", typeof(DateTime)).From("End"); model.Field("description", typeof(string)).From("Description"); model.Field("LabourId", typeof(int)).From("LabourId"); }) ) .Events(e => e.RequestEnd("ValidationChecker")) ) .AllDaySlot(false) .AutoBind(false) )So as you can see I am grouping by "Labour",and each event has a corresponding "LabourId".
Updates are sent to the UpdateSchedule action in the SchedulerController, and I have added some server-side validation there to prevent each Labour resource having overlapping events. If all is well I return a null, and the scheduler does what it wants, if there is an overlap I return a JSON with some data to explain that the change is not possible. In the scheduler datasource you can see on the RequestEnd event I call a function "ValidationChecker", which checks the response data, and when the UpdateSchedule action indicates the change cannot be made, I do the following:
var scheduler = $("#Scheduler").data("kendoScheduler"); scheduler.dataSource.cancelChanges(); e.preventDefault();This works, but it only works once consecutively. If I overlap two events, the change is rejected by the validation, and the event that was moved is snapped back to its original place. I can move it around some more and try again, and it will fail again. If two updates fail in a row, the event disappears entirely. I am not sure what is happening here.
Is there a correct way to cancel an update?
...also is there a way to specify a title for a custom view in the MVC scheduler?

Dear Telerik-team,
in my application, I am using the Kendo Map widget and bind it to a view model. Therefore, I followed this example:
http://docs.telerik.com/aspnet-mvc/helpers/map/how-to/bind-map-to-model
Works, the data coming from the database is displayed on the map as markers. That is the HTML code:
@(Html.Kendo().Map()
.Name(Model.Name)
.Center(Model.CenterLatitude, Model.CenterLongitude)
.Zoom(Model.Zoom)
.Layers(layers => layers
.Add()
.Type(MapLayerType.Tile)
.UrlTemplate(Model.TileUrlTemplate)
.Subdomains(Model.TileSubdomains)
.Attribution(Model.TileAttribution)
)
.Markers(markers =>
{
foreach (var marker in Model.Markers)
{
markers.Add()
.Location(marker.latlng)
.Title(marker.name);
}
})
.Events(events => events
.MarkerClick("onMarkerClick"))
)
I want to redirect to a controller action when a user clicks on a marker. Ideally by passing an ID to that controller action in order to fetch the corresponding data of the item from the database. Is there a way to attach the ID of the item, the markers represent, to the marker (like it is possible to specify a title e.g.)?
And how would in this case look the javascript method whichs would call the controller action?
I tried to display the name of the marker with the following javascript:
<script>
function onMarkerClick(e) {
var dataItem = e.sender.marker.dataItem;
alert(dataItem.name)
}
</script>
But this doesn't work :-/
Happy to hear from you,
best regards,
Marco
Kendo UI for jQuery documentation at http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.selectable states
"As of the Kendo UI R2 2017 SP1 release, the selection of columns with checkboxes is a built-in feature for the Grid..."
There does not seem to be a HtmHelper in Razor in Telerik UI for ASP.NET MVC for adding the selectable 'column' of checkboxes as in the manner shown for Kendo UI sample at https://dojo.telerik.com/ehaDo
In this sample, a SQL pivot view is surfaced to the page as a Grid<dynamic> because the pivot columns are unknown at coding time. The DataTable of the pivot view is delivered via ViewBag so the Model can be built and fields added dynamically to the grid at init time.
There is no 'columns.Selectable()' as I might expect.
@(Html.Kendo().Grid<dynamic>() .Name("master") .DataSource(dataSource => dataSource .Ajax() .Model(model => { var id = ViewBag.TestGridDataTable.PrimaryKey[0].ColumnName; model.Id(id); foreach (System.Data.DataColumn column in ViewBag.TestGridDataTable.Columns) { model.Field(column.ColumnName, column.DataType).Editable(false) ; } }) .Read(read => read.Action("Read", "Results")) ) .Columns(columns => { columns.Selectable(); // <----- does not add a check box column foreach (System.Data.DataColumn column in ViewBag.TestGridDataTable.Columns) { columns.Bound(cn); } })Do I have to create a new version of the model with an extra boolean field and go from there ?
I just updated to release '2015.1.318' and a Grid that was working fine with several ForeignKey columns bound to Guid and selectlists is now not working. I add and update In-Line on the grid. Now when I CREATE a new Entity inline - the editor displays all the data perfectly but the data sent to the server does not include the values selected for the ForeignKey columns. These are sent as Empty Guids i.e.00000000-0000-0000-0000-000000000000.
Note - when I UPDATE an existing entity it all works fine, the problem is only when I CREATE\INSERT.
The code for the Grid is below and the EditorTemplate for the ForeignKey column is also there.
Grid
<script type="text/javascript"> function gridEntityAssignments_CreateData() { return { assignedTo: "@(assignedTo)", assignedToOid: "@(assignedToOid)", }; }</script>@*All Required*@@Html.Hidden("IsAssignments", isAssignments)@Html.Hidden("AssignmentsAssignedToOid", assignedToOid)@Html.Hidden("AssignmentsAssignedTo", assignedTo)<div style="width: 100%"> @(Html.Kendo().Grid<Mallon.AssignedTo.Models.ViewGridAssignment>() .Name("GridEntityAssignments") .AutoBind(isAssignments) //if false - Report not loaded on page initialise .HtmlAttributes(new { @class = "ignore" }) .ToolBar(toolbar => { toolbar.Create().HtmlAttributes(new { @class = "dfw-ignoreDirtyLink" }); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Scrollable(s => s.Height("auto")) .Columns(columns => { columns.Bound(p => p.Oid).Visible(false); columns.ForeignKey(p => p.UserOid, (System.Collections.IEnumerable)ViewData["AssignmentUsers"], "Value", "Text").EditorTemplateName("GridForeignKeyWithSelect").Title("User"); columns.ForeignKey(p => p.AssignmentTypeOid, (System.Collections.IEnumerable)ViewData["AssignmentTypes"], "Value", "Text").EditorTemplateName("GridForeignKeyWithSelect").Title("Type"); columns.Bound(p => p.Info).EditorTemplateName("GridTextArea"); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172); }) .DataSource(dataSource => dataSource .Ajax() .AutoSync(false) .Model(model => { model.Id(p => p.Oid); model.Field(p => p.Oid).DefaultValue(Guid.Empty); }) .Events(e => e.Error("handleAjaxError")) .Destroy(update => update.Action("Assignments_GridDelete", "Assignment")) .Update(update => update.Action("Assignments_GridUpdate", "Assignment")) .Create(update => update.Action("Assignments_GridCreate", "Assignment").Data("gridEntityAssignments_CreateData")) .Read(read => read.Action("Assignments_GridRead", "Assignment", new { assignedToOid = assignedToOid })) ))</div>
Editor Template
@model object@( Html.Kendo().DropDownListFor(m => m) .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"]).OptionLabel("Please Select"))