Я нахожусь в процессе создания нового веб-приложения MVC v3 Razor и, похоже, у меня возникают проблемы при чтении значений из частичных представлений.
У меня есть ViewModel (заголовок), который состоит из трех другихViewModels
public ProfileVM Profile { get; set; }
public SpecsVM Specs { get; set; }
public GeneralVM General { get; set; }
public Guid Id { get; set; }
У меня есть страница, строго привязанная к модели представления Title, на которой я использую синтаксис @ Html.RenderPartial для рендеринга каждого из других ViewModels (профиля и т. Д.) В другое частичное представление.Кажется, это работает правильно, но я бы хотел, чтобы только одна кнопка на странице обрабатывала размещение данных, и хотел бы захватить значения, введенные пользователем, в частичные представления.Это возможно?Заранее спасибо
Сгенерированный HTML по запросу разделов формы.Я не добавил информацию главной страницы
<form action="/Titles/Title/Edit/2bb75b02-9dd7-e011-971f-0003fffb8797" method="post">
<fieldset>
<h1>
Title Details</h1>
<form action="/Titles/Title/Edit/2bb75b02-9dd7-e011-971f-0003fffb8797" method="post">
<fieldset>
<p>
<input type="submit" value="Save" name="TitleGeneral"/>
</p>
<hr />
<table>
<tr>
<td class="editor-label" style="width: 150px;"><label for="TitleCode">Code</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="TitleCode" name="TitleCode" type="text" value="T00006" /> <span class="field-validation-valid" data-valmsg-for="TitleCode" data-valmsg-replace="true"></span>
</td>
<td rowspan="7"> <img src="../../../../Content/demoBF.jpg" width="150px" height="150px" /></td>
</tr>
<tr>
<td class="editor-label">
<label for="TitleName">Title</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="TitleName" name="TitleName" type="text" value="Beaches Of France" />
<span class="field-validation-valid" data-valmsg-for="TitleName" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="SubTitle">Sub Title</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="SubTitle" name="SubTitle" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="SubTitle" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="SortingTitle">Sorting Title (If Different)</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="SortingTitle" name="SortingTitle" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="SortingTitle" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label"><label for="ShortTitle">Short or abbreviated title</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="ShortTitle" name="ShortTitle" type="text" value="TRO1" />
<span class="field-validation-valid" data-valmsg-for="ShortTitle" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label"><label for="Comments">Comments</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="Comments" name="Comments" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Comments" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="Author">Author</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="Author" name="Author" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Author" data-valmsg-replace="true"></span>
</td>
</tr>
</table>
</fieldset>
</form> <br />
<br />
<ul class="tabs">
<li><a href="#tab1">Profile</a></li>
<li><a href="#tab2">Specification</a></li>
<li><a href="#tab3">Authors</a></li>
<li><a href="#tab4">Editions</a></li>
<li><a href="#tab5">Restrictions</a></li>
<li><a href="#tab6">Licences</a></li>
<li><a href="#tab7">Purchases</a></li>
<li><a href="#tab8">Restrictions</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content">
<!--Content-->
<form action="/Titles/Title/Edit/2bb75b02-9dd7-e011-971f-0003fffb8797" method="post">
<fieldset>
<p>
<input type="submit" value="Save" name="TitleProfile"/>
</p>
</fieldset>
</form> </div>
<div id="tab2" class="tab_content">
<!--Content-->
<form action="/Titles/Title/Edit/2bb75b02-9dd7-e011-971f-0003fffb8797" method="post">
<fieldset>
<table>
<tr>
<td class="editor-label" style="width: 150px;"><label for="Pages">Pages</label>
</td>
<td class="editor-label"><input class="text-box single-line" data-val="true" data-val-number="The field Pages must be a number." id="Pages" name="Pages" type="text" value="96" />
<span class="field-validation-valid" data-valmsg-for="Pages" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label"><label for="Plates">Plates or illustrations</label>
</td>
<td class="editor-label"><input class="text-box single-line" data-val="true" data-val-number="The field Plates or illustrations must be a number." id="Plates" name="Plates" type="text" value="64" />
<span class="field-validation-valid" data-valmsg-for="Plates" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="PlateType">Plate Type</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="PlateType" name="PlateType" type="text" value="Full-colour photographs" />
<span class="field-validation-valid" data-valmsg-for="PlateType" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="Format">Format</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="Format" name="Format" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Format" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="OtherSpecs">Other specifications</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="OtherSpecs" name="OtherSpecs" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="OtherSpecs" data-valmsg-replace="true"></span>
</td>
</tr>
</table>
</fieldset>
</form> </div>
<div id="tab3" class="tab_content">
<!--Content-->
<form action="/Titles/Title/Edit/2bb75b02-9dd7-e011-971f-0003fffb8797" method="post">
<fieldset>
<table>
<tr>
<td class="editor-label" style="width: 150px;"><label for="Pages">Pages</label>
</td>
<td class="editor-label"><input class="text-box single-line" data-val="true" data-val-number="The field Pages must be a number." id="Pages" name="Pages" type="text" value="96" />
<span class="field-validation-valid" data-valmsg-for="Pages" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label"><label for="Plates">Plates or illustrations</label>
</td>
<td class="editor-label"><input class="text-box single-line" data-val="true" data-val-number="The field Plates or illustrations must be a number." id="Plates" name="Plates" type="text" value="64" />
<span class="field-validation-valid" data-valmsg-for="Plates" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="PlateType">Plate Type</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="PlateType" name="PlateType" type="text" value="Full-colour photographs" />
<span class="field-validation-valid" data-valmsg-for="PlateType" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="Format">Format</label>
</td>
<td class="editor-label"><input class="text-box single-line" id="Format" name="Format" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Format" data-valmsg-replace="true"></span>
</td>
</tr>
<tr>
<td class="editor-label">
<label for="OtherSpecs">Other specifications</label>
</td>
<td class="editor-label">
<input class="text-box single-line" id="OtherSpecs" name="OtherSpecs" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="OtherSpecs" data-valmsg-replace="true"></span>
</td>
</tr>
</table>
</fieldset>
</form> </div>
</div>
</fieldset>
</form><div>
<a href="/Titles/Title">Back to List</a>
</div>
</td></tr>
</table>