1

So I have this master/detail setup with a WebGrid. All is well until I try and use RenderPage to display the detail when a record is clicked:

<div class="innerbox">
    @{
        if(gdEligibility.HasSelection){
             @RenderPage("~/Views/Eligibility/EligibilityPolicyDetailView.cshtml",
                 new { Customer = gdEligibility.SelectedRow })
        }
    }
</div>

Everything works, if I put a break point I can step through the detail view's cshtml file no problem, no errors. But nothing is ever rendered between the outer div's. Ever. Why doesn't RenderPage return anything? I even tried adding .ToHtmlString() on the end of the line but still nothing.

The detail cshtml:

@{ foreach(TravelInsurance.Models.Policy p in Page.Customer.Policies){

<fieldset>
    <legend>Policy</legend>

    <div class="display-label">Policy Number</div>
    <div class="display-field">
        @Html.DisplayFor(model => p.PolicyNumber)
    </div>

    <div class="display-label">Premium</div>
    <div class="display-field">
        @Html.DisplayFor(model => p.Premium)
    </div>
</fieldset>
}}
sharptooth
  • 167,383
  • 100
  • 513
  • 979

2 Answers2

0

This question suggests that RenderPage will use the parent model...

Maybe try using

@{Html.RenderPartial("EligibilityPolicyDetailView", new { Customer = gdEligibility.SelectedRow });}

or

@Html.Partial("EligibilityPolicyDetailView" ,new { Customer = gdEligibility.SelectedRow })
Community
  • 1
  • 1
Stafford Williams
  • 9,696
  • 8
  • 50
  • 101
0

Pl. try again by removing the attribute "ajaxUpdateContainerId" in the grid definition and it should work.