开发者

Can a partial view be used to do Ajax item updates?

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.DefectCo开发者_StackOverflow社区des) { %>

    <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>


<% foreach (var item in Model.DefectCodes) { %>

    <tr>
        <% using (Ajax.BeginForm("Create", new AjaxOptions() ))
           {%>

        <!--should be easy like this!--><!--ur codeid here-->
        <%=Html.HiddenFor(modelItem => item.codeid)%> 

        <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>

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 3 TD and get more value than the shown on form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜