可以使用部分视图来进行 Ajax 项目更新吗?
我有一个根据缺陷代码列表构建的表。
每行的一部分可以加载一个带有提交按钮的子表项吗?
示例表:
<table><tr>
<th>Code</th><th>Description</th>
<th>Impact to your customers</th>
<th>Impact to your associates</th>
<th>Save</th>
<th>Save Errors</th></tr>
前 2 列是从查找表中填充的,接下来的 3 列是一个表单,以便用户可以设置值或根据以前的值更新它们。
我能否以某种方式在单个 Ajax 表单中每行包含 3 个 TD
项,并将 codeId 作为隐藏值嵌入?我的强类型视图会继承什么?外层将继承 IEnumerable
,部分视图将继承 AssessmentDTO
类型?
这是我想要运行的实际表:
<table>
<tr>
<th>
Code
</th>
<th>
Description
</th>
<th>
Document
</th>
<th>
Customer Contact Required for Resolution
</th>
<th>
AssociateSeverity
</th>
<th>
ShareholderSeverity
</th>
<th>
CustomerSeverity
</th>
<th>
RegulatorySeverity
</th>
<th>
RootCause
</th>
<th>
Investor Requirements*
</th>
</tr>
<% foreach (var item in Model.DefectCodes) { %>
<tr>
<% using (Ajax.BeginForm("Create", new AjaxOptions() ))
{%>
<td>
<%= Html.Encode(item.Code)%>
</td>
<td>
<%= Html.Encode(item.Description)%>
</td>
<% Html.RenderPartial("Create",null, ViewData); %><!-- This is where the form is -->
<% } %>
</tr>
<% } %>
</table>
I have a table built from a list of defect codes.
Can part of each row load a sub-table item complete with submit buttons?
Sample table:
<table><tr>
<th>Code</th><th>Description</th>
<th>Impact to your customers</th>
<th>Impact to your associates</th>
<th>Save</th>
<th>Save Errors</th></tr>
Where the first 2 columns are populated from the lookup table, and the next 3 columns are a form so the user can set the values or update them from previous values.
Can I somehow have 3 TD
items per row an individual Ajax form with the codeId embedded as a hidden value? What would my strongly typed view(s) inherit? the outer layer would inherit IEnumerable<DefectDTO>
, and the partial views would inherit the AssessmentDTO
type?
Here's the actual table I'm trying to get to function:
<table>
<tr>
<th>
Code
</th>
<th>
Description
</th>
<th>
Document
</th>
<th>
Customer Contact Required for Resolution
</th>
<th>
AssociateSeverity
</th>
<th>
ShareholderSeverity
</th>
<th>
CustomerSeverity
</th>
<th>
RegulatorySeverity
</th>
<th>
RootCause
</th>
<th>
Investor Requirements*
</th>
</tr>
<% foreach (var item in Model.DefectCodes) { %>
<tr>
<% using (Ajax.BeginForm("Create", new AjaxOptions() ))
{%>
<td>
<%= Html.Encode(item.Code)%>
</td>
<td>
<%= Html.Encode(item.Description)%>
</td>
<% Html.RenderPartial("Create",null, ViewData); %><!-- This is where the form is -->
<% } %>
</tr>
<% } %>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它只是解决了你的隐藏价值!问题..
您不需要将其放入
TD
中,因为您希望将其隐藏,因此它仍然会获得您的值,但不会显示在表单、表或视图中。这样您就可以保留 3TD
并获得比表格上显示的更多的价值。its just solves ur hidden value! problem..
u dont need to put it into a
TD
cause u want it to be hidden so it will still get the value for u but will not be shown in form or in table or in view.. that way u can keep 3TD
and get more value than the shown on form.