Hi!
I'm new to MVC4 and thus built some little demo including a Kendo UI Grid and a partial view which serves as a custom editor. Everything works perfect except that the AntiForgeryToken gets lost on the way.
This is my definition of the grid:
And this is the start of my partial view named "ProductEditor.cshtml" saved in subdir "EditorTemplates":
The popup opens as it should and everything works fine except that the hidden input for AntiForgeryToken looks like this:
In other words: the value is empty. Placing the AntiForgeryToken helper somewhere else in my views it is working perfectly.
What am I doing wrong?
Regards
Neils
I'm new to MVC4 and thus built some little demo including a Kendo UI Grid and a partial view which serves as a custom editor. Everything works perfect except that the AntiForgeryToken gets lost on the way.
This is my definition of the grid:
@(Html.Kendo().Grid(Model) .Name("grdProducts") .Columns(columns => { columns.Bound(p => p.Name); columns.Bound(p => p.ProductType); columns.Bound(p => p.SellStartDate); columns.Bound(p => p.SellEndDate); columns.Command(command => command.Edit()).Width(160); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable .Mode(GridEditMode.PopUp) .DisplayDeleteConfirmation(true) .TemplateName("ProductEditor") .Window(w => w .Width(700) .Title("Edit Product"))) .Pageable(pa => pa.Numeric(false).PageSizes(new [] {5,10,20})) .Scrollable(scr => scr.Height(430).Virtual(false)) .Selectable(selectable => selectable.Mode(GridSelectionMode.Single)) .DataSource(dataSource => dataSource .Ajax() .AutoSync(false) .Batch(false) .PageSize(20) .ServerOperation(false) .Model(model => { model.Id(p => p.Id); model.Field(p => p.Id).Editable(false); model.Field(p => p.CategoryName).Editable(false); model.Field(p => p.ProductType).DefaultValue((int)ProductTypeEnum.Cameras); }) .Create(create => create.Action("EditingCreate", "Product")) .Read(read => read.Action("EditingRead", "Product")) .Update(update => update.Action("EditingUpdate", "Product")) ))@model _ProductStore.Infrastructure.Models.Products.Product
@{
ViewBag.Title = "Edit";
}
@using (Html.BeginForm()){ @Html.AntiForgeryToken() @Html.ValidationSummary(true) <fieldset>... all labels and fields... </fieldset>}<input name="__RequestVerificationToken" type="hidden" data-bind="value:__RequestVerificationToken" value=""/>What am I doing wrong?
Regards
Neils