Action returning Partial view and model
I'm new to MVC 3 and I have a question regarding the correct approach.
Imagine I have a form
<tr>
<td class="editor-field">
@Html.TextBoxFor(m => m.UserName)
</td>
</tr>
....
And model:
[Required]
public string UserName { get; set; }
[Required]
public DateTime? Birthdate { get; set; }
....
And somewhere in middle I have a:
@Html.Action("LocationGroup", "Home")
Which will load a new partial view with group of controls together:
[ChildActionOnly]
public ActionResult LocationGroup()
{
Model model = new Model();
return PartialView("_TempView", model);
}
Basically my question is, how can i merge this model together with data, i mean in that LocationGroup method, I have to create a new model, I can't pass existing.
With other words I'm kinda lost with the Models in this particular situation.
Cuz also after submitting the form, how can i retrieve the data, from that partial view with action?
Any help is appreciated
I'm new to MVC 3 and I have a question regarding the correct approach.
Imagine I have a form
<tr>
<td class="editor-field">
@Html.TextBoxFor(m => m.UserName)
</td>
</tr>
....
And model:
[Required]
public string UserName { get; set; }
[Required]
public DateTime? Birthdate { get; set; }
....
And somewhere in middle I have a:
@Html.Action("LocationGroup", "Home")
Which will load a new partial view with group of controls together:
[ChildActionOnly]
public ActionResult LocationGroup()
{
Model model = new Model();
return PartialView("_TempView", model);
}
Basically my question is, how can i merge this model together with data, i mean in that LocationGroup method, I have to create a new model, I can't pass existing.
With other words I'm kinda lost with the Models in this particular situation.
Cuz also after submitting the form, how can i retrieve the data, from that partial view with action?
Any help is appreciated
No comments:
Post a Comment