You simply have some value in your main view that you want to access in a partial being rendered in that view.
If you just render a partial with just the partial name:
@Html.Partial("_SomePartial")
It will actually pass your model as an implicit parameter, the same as if you were to call:
@Html.Partial("_SomePartial", Model)
Now, in order for your partial to actually be able to use this, though,
it too needs to have a defined model, for example:
@model Namespace.To.Your.Model
@Html.Action("MemberProfile", "Member", new { id = Model.Id })
Alternatively, if you're dealing with a value that's not on your view's model
(it's in the ViewBag or a value generated in the view itself somehow,
then you can pass a ViewDataDictionary
@Html.Partial("_SomePartial", new ViewDataDictionary { { "id", someInteger } });
And then:
@Html.Action("MemberProfile", "Member", new { id = ViewData["id"] })
As with the model, Razor will implicitly pass your partial the view's ViewData by default,
so if you had ViewBag.Id in your view, then you can reference the same thing in your partial.
for (int i = 0; i < Model.Insureds.Count; i++)
{
var viewDataDict = new ViewDataDictionary
{
new KeyValuePair<string, object>("Prefix", "Insureds[" + i + "]"),
new KeyValuePair<string, object>("EndorsementType", Model.EndorsementType.ToString()),
new KeyValuePair<string, object>("InsuredId", Model.Insureds[i].Id)
};
@Html.Partial("_Insured", Model.Insureds[i], viewDataDict)
}