I\'m using Steve Sanderson\'s BeginCollectionItem approach to add dynamic content. Everything works fine when I\'m doing it on the first level. However, when try to implemen
To get the prefix with an Html.BeginCollectionItem
, you can access ViewData.TemplateInfo.HtmlFieldPrefix
(I'm using the nuget package). You're on the right track with tt.transfers
, but you need the specific prefix instead.
Instead of just
Html.BeginCollectionItem("tt.transfers")
you'll need the prefix of the current payment_method as well.
@{
var paymentMethodPrefix = ViewData.TemplateInfo.HtmlFieldPrefix;
}
@using (Html.BeginCollectionItem(paymentMethodPrefix + ".tt.transfers"))
and a quick test looks like you can also just:
@using (Html.BeginCollectionItem(ViewData.TemplateInfo.HtmlFieldPrefix + ".tt.transfers"))