Tyler Smith
Tyler Smith

Reputation: 1279

Getting data from partials

I have a main model that contains 3 objects that each line up to a partial view. The model is passed into a form that has 4 partials which each of the partials has part of the model passed into. When my form submits (from the main view, not the partials) I am not getting an data from the partials in the controller. Is there something I am missing? It seems I can send data from the model to the partials, have trouble getting it back on the form submit.

Main View  
@model  
@Html.BeginForm  
{  
->Partial1(model.section1)  
->Partial2(model.section2)  
->Partial3(model.section3)  
->Partial4(model.section4)  
submit button  
}

I can post more info if I didn't explain something very well.
Thanks in advance for the help.

Upvotes: 1

Views: 58

Answers (2)

Tyler Smith
Tyler Smith

Reputation: 1279

The solution I came up with is EditorTemplates. These allowed me to get the info from the sectioned out bits of the form.

Upvotes: 1

TFD
TFD

Reputation: 24524

If your partials are collections see http://nuget.org/packages/BeginCollectionItem

Upvotes: 0

Related Questions