asp.net mvc 4 - MVC4 Kendo Project Ajax.BeginForm UpdateTargetId Issue -
i have started new project in mvc4 using code existing mvc3 project. can forcefulness form ajax reload specific div, not using normal submit method, test dosomthing() javascript function. missing?
to clarify: first button not work right, sec 1 - don't want way.
view
@using (ajax.beginform("method1", null, new ajaxoptions { httpmethod = "post", updatetargetid = "divpartial1" }, new { id = "form1" })) { <div class="data"> @html.labelfor(x => x.totalsubmitted, new { @class = "total" })<div class="number total">@html.formatvalue(model.totalsubmitted, "{0:n0}")</div> ... </div> <div class="details"> <div id="divpartial1"> @html.partial("reportdashboardapppartial") </div> </div> <div style="text-align: center;"> <button type="submit" class="k-button"><span class="k-icon k-i-search" /></button> <button type="button" name="save" value="save" onclick="dosomething(); homecoming false;"><span class="k-icon k-i-search" /></button> </div> } <script type="text/javascript"> function dosomething() { $.ajax({ url: '@url.action("method1", "controller")', type: 'post', data: $('form#form1').serialize(), success: function (result) { $('#divpartial1').html(result); } }); } </script>
_layout
@model baseviewmodel <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>@viewbag.title</title> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <meta name="viewport" content="width=device-width" /> @scripts.render("~/bundles/modernizr") @scripts.render("~/bundles/jquery") <link href="@url.content("~/content/kendo.compatibility.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2012.3.1114/kendo.common.min.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2012.3.1114/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2012.3.1114/kendo.default.min.css")" rel="stylesheet" type="text/css" /> @rendersection("styles", false) <script src="@url.content("~/scripts/kendo/2012.3.1114/jquery.min.js")"></script> <script src="@url.content("~/scripts/kendo/2012.3.1114/kendo.all.min.js")"></script> <script src="@url.content("~/scripts/kendo/2012.3.1114/kendo.aspnetmvc.min.js")"></script> @rendersection("scripts", false) </head> <body> @html.partial("_alertwindow") <div id="wrapper"> <header> <div id="logindisplay"> @html.partial("_loginpartial") </div> <a href="@url.action("index", "home")"> <div id="logo"></div> </a> <div id="title"> <h1>ha!</h1> </div> @(html.kendo().menu().name("menu").bindto("main").securitytrimming(true)) </header> <div id="main"> @renderbody() </div> <footer> <div id="version">@html.actionlink("version " + @model.currentversion, "about", "home")</div> </footer> </div> @rendersection("end_scripts", false) </body> </html>
i know should work.
i had same problem. solution add together statement in _layout.cshtml page.
@scripts.render("~/bundles/jqueryval")
the definition of scriptbundle("~/bundles/jqueryval") below
bundles.add(new scriptbundle("~/bundles/jqueryval").include( "~/scripts/jquery.unobtrusive*", "~/scripts/jquery.validate*"));
asp.net-mvc-4 kendo-ui
No comments:
Post a Comment