Jqueryタブを使用してコンテンツをレイアウトする単純なASP.net MVC Webiteがあります。タブの1つでは、ユーザーがシステム設定の詳細を更新できるようにする、独自のモデルにバインドされた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 %>
そして、これが提出する方法である:ここでは、レンダリングされているpartialviewの部分がある
<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のタブ –
でこれを詳しく説明できますか?または、例へのリンクを提供しますか? – Matt
MVCとAJAX実装の詳細については、下記のリンクをご覧ください。 http://stackoverflow.com/questions/7333904/asp-net-mvc-3-ajax/7334036#7334036 –