I am trying to create a Edit View for the following scenario:
Profile class { String profileName, IList<Phase> phases; //plus there getter setter}
Phase class { String phaseName, IList<SubPhase> subPhases; //plus there getter setter}
SubPhase class { String subPhaseName // plus there getter setter}
I have created Profile View with @model CollectionEditing.Models.Profile
and two partial view as PhaseEditor and SubPhaseEditor
I profile view I am using partial view:
//iteration the phases
for (int i = 0; i < Model.Phases.Count; i++)
{
//rendering the partial view for Phases
Html.RenderPartial("PhaseEditor", Model.Phases[i]);
//iteration the SubPhases
for (int j = 0; j < Model.Phases[i].SubPhases.Count; j++)
{
//rendering the partial view for SubPhases
Html.RenderPartial("SubPhaseEditor", Model.Phases[i].SubPhases[j]);
}
}
The Editable View is created successfully.
When I click the Submit button In my action I getting the values for Profile and its list of Phases and I am not getting the list of Subphase in Phase class. list of subphases is set to null.
I have also tried putting Html.RenderPartial("SubPhaseEditor", Model.Phases[i].SubPhases[j]);
in partial view PhaseEditor but still it does not work.
Please help... How I can get the list of SubPhases also.
Thank you very much for your help.
Sushil