我有一个简单的ASP.net mvc网站,其中使用JQuery的标签来布局内容。在其中一个选项卡中,我呈现了一个PartialView,该PartialView绑定到它自己的模型,允许用户更新其系统设置细节。这里是partialview的一部分被渲染:ASP.net mvc表单验证内Jquery标签
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(of SystemSetupViewModel)" %>
<% Using Html.BeginForm("UsrCtlSystemSetup", "User", FormMethod.Post)%>
<%: Html.ValidationSummary(True, "Invalid details supplied.")%>
<div class="tabDynamicHeight ">
<div class="FormFullRow formLayoutLabel">
<div class="Seperator">
<div class="FormFullRow longInput">
<%: Html.LabelFor(Function(model) model.WebsiteAddress)%>
<%: Html.TextBoxFor(Function(model) model.WebsiteAddress)%>
<%: Html.ValidationMessageFor(Function(model) model.WebsiteAddress)%>
</div>
<small class="helpText FullRow">Your Companies Website Address.</small>
</div>
</div>
<div class="FloatButtonLeft">
<input type="submit" value="Save" class="FloatButtonLeft BlueBtnMedium" />
</div>
</div>
<% End Using %>
这是提交方法:
<HttpPost()> _
<ValidateInput(False)> _
Public Function UsrCtlSystemSetup(ByVal btnSubmit As String, ByVal model As SystemSetupViewModel) As ActionResult
model.SaveChanges()
Return PartialView("UsrCtlSystemSetup", model)
End Function
我就是应该从这个方法返回的问题。返回一个partialView只返回一个占据整个页面的partialview。我需要能够以某种方式将部分视图返回到持有jquery选项卡。这可能吗?我可以做一个RedirectToAction回到父页面操作,但这意味着如果在提交的partialviews模型中有错误,我将无法显示它。希望这是有道理的。
在此先感谢
你可以尝试更新页面的部分部分,例如选项卡ajax – 2012-03-06 03:22:21
你有什么机会可以详细说明这一点?或者提供一个例子的链接? – Matt 2012-03-06 04:25:48
请在下面的链接中找到有关MVC和AJAX实施的更多信息 http://stackoverflow.com/questions/7333904/asp-net-mvc-3-ajax/7334036#7334036 – 2012-03-06 04:45:11