1
To create some fields dynamically, I’m using a render and render. When calling Partial _Contact, I would like to pass the [i] value of the for index to sort the fields. It is not working... You’re making a mistake on the page... does anyone know how to help me? A hug!
Generating the fields:
@for (int i = 0; i < Model.PessoasContatosViewModel.Count; i++)
{
@await Html.PartialAsync("_Contato", Model.PessoasContatosViewModel[i], new ViewDataDictionary { { "indice", i } })
}
Receiving the Model and Parameter in Partialview:
@model Retaguarda.Application.ViewModels.Pessoa.PessoaContatoViewModel
@{
string valuePassedIn = this.ViewData.ContainsKey("indice") ? this.ViewData["indice"].ToString() : "0";
}
you are the guy!!!! Thank you very, very much :)
– Master JR