Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi, at the moment I have a OrderConfirmationController which has a Details view which displays the records. At the bottom of the Details View I want to add 5 fields from another table that will be displayed in the view but not sure how to add them.
 
At the bottom of the last table I want to implement a separate table containing the Product_ID, Description, Price, Quantity and Total from a Sales_Order_Line table but don't know how to add it as I can only reference one table using the @model at the start of the view.
 
Thanks.
 
Here is my code for the Details controller:
       public ActionResult Details(string documentNo, int documentType)
    {
        // Compound key is used here so require both fields to be included in the SQL.
        Sales_Order confirmOrder = _data.Sales_Orders
           .Where(x => x.Document_Type == documentType && x.Document_No_ == documentNo)
           .FirstOrDefault();
        return View(confirmOrder);
 

    }
 
Here is the code for my view:
@model SPR.Titanium.MultiChannel.ManagementConsolePortal.Sales_Order
 

<link href="~/Content/themes/ui-lightness/jquery-ui-1.10.3.custom.css" rel="stylesheet"     />
 
@section Scripts
{
@Scripts.Render("~/bundles/jqueryui");
<script src="~/js/jquery-1.9.1.js"></script>
<script src="~/js/jquery-ui-1.10.3.custom.js"></script>
<script>
    $(function () {
        $("#accordion").accordion();
    })
</script>
 
}
 
@{
ViewBag.Title = "Order Confirmation Details";
}
 
<h2>Order Confirmation</h2>
 
@using (Html.BeginForm())
{
<div id="accordion">
    <div class="editor-field">
        Billing Details:
    </div>
    <div class="editor-field">
        <table style="width:100%">
            <tr>
                <th style="width:20%">Billing Name</th>
                <td style="width:30%">@Html.EditorFor(model =>   model.Sell_to_Customer_Name)</td>
                <th style="width:20%">Address</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_Address).  </td>
                <th style="width:20%">Address 2</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_Address).  </td>
            </tr>
            <tr>
                <th style="width:20%">City</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_City)</td>
                <th style="width:20%">County</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_County).</td>
                <th style="width:20%">Post Code</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_Post_Code)</td>
            </tr>
            <tr>
                <th style="width:20%">Country</th>
                <td style="width:30%">@Html.EditorFor(model => model.Bill_to_Country_Region_Code)</td>
            </tr>
 
        </table>
    </div>
    <div class="editor-label">
        Delivery Details
    </div>
    <div class="editor-field" aria-readonly="true">
        <table style="width:100%">
            <tr>
                <th style="width:20%">Delivery Name</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_Contact_Name)</td>
                <th style="width:20%">Address</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_Address)</td>
                <th style="width:20%">Address 2</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_Address_2)</td>
                </tr>
            <tr>
                <th style="width:20%">City</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_City)</td>
                <th style="width:20%">County</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_County)</td>
                <th style="width:20%">Post Code</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_Post_Code)</td>
            </tr>
            <tr>
                <th style="width:20%">Country</th>
                <td style="width:30%">@Html.EditorFor(model => model.Ship_to_Country_Region_Code)</td>
            </tr>
            </table>
    </div>
 
</div>    
Posted 18-Jun-13 3:22am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 274
1 Shweta N Mishra 216
2 PIEBALDconsult 210
3 Sergey Alexandrovich Kryukov 185
4 BillWoodruff 174
0 OriginalGriff 7,620
1 Sergey Alexandrovich Kryukov 6,937
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,495


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 18 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100