I have index.cshtml as follows:
read works fine showing all records. When I click 'Add New Record', it shows error as follows.
@model IEnumerable<Dadavani.Models.Dad_Repost_Transaction>@{ Layout = "~/Views/Shared/_Layout.cshtml";}@{ ViewBag.Title = "Repost";}<script src="../../Scripts/Kendo/jquery.min.js" type="text/javascript"></script><script src="../../Scripts/Kendo/kendo.web.min.js" type="text/javascript"></script><script src="../../Scripts/Kendo/kendo.aspnetmvc.min.js" type="text/javascript"></script><script src="../../Scripts/Kendo/console.js" type="text/javascript"></script><link href="../../Content/Kendo/kendo.common.min.css" rel="stylesheet" type="text/css" /><link href="../../Content/Kendo/kendo.default.min.css" rel="stylesheet" type="text/css" /><h2>Repost</h2>@(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns.Bound(model => model.SR_NO); columns.Bound(model => model.MEMBER_ID); columns.Bound(model => model.R_MONTH); columns.Bound(model => model.PRINT_YN); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200); }) .ToolBar(toolbar => { toolbar.Create(); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Groupable() .Pageable() .Sortable() .Scrollable() .Filterable() .DataSource(dataSource => dataSource .Ajax() .Model(p => p.Id(model => model.SR_NO)) .Create(update => update.Action("Create", "Repost")) //.Read(read => read.Action("GetReposts", "Repost")) .Read(read => read.Action("Read", "Repost")) .Update(update => update.Action("Update", "Repost")) .Destroy(update => update.Action("Destroy", "Repost")) ) )<div id="Grid"></div>read works fine showing all records. When I click 'Add New Record', it shows error as follows.
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet
the method I created is as follows which is similar to UI Kendo MVC examples. So, what is the problem?[AcceptVerbs(HttpVerbs.Post)] public ActionResult Create([DataSourceRequest] DataSourceRequest request, Dad_Repost_Transaction repost) { if (repost != null && ModelState.IsValid) { context.Reposts.Add(repost); context.SaveChanges(); } return Json(new [] { repost }.ToDataSourceResult(request, ModelState),JsonRequestBehavior.AllowGet);
}