I want to send ViewData.model to Special action with the last user data entry.
I mean, the Edit form is showed to the User, User input values to some fields, when he/she will click on the Ajax.ActionLink, I am supposed to get my Model with the last modified in the action.
开发者_如何学GoI am sending ViewData.Model to the Action with the below code, but i can not catch last changed value.
<%=Ajax.ActionLink("Contact this person Ajax", "MyAction", "MyController",ViewData.Model, new AjaxOptions { InsertionMode = InsertionMode.Replace }, new { @class = "thickbox" })%>
and My Action Code:
[AcceptVerbs(HttpVerbs.Get)]
public PartialViewResult MyAction(MyModel model){
.....}
What shall i do?
You need to use Ajax.BeginForm
instead of Ajax.ActionLink
. With Ajax.ActionLink
you need to manually pass all the values. With Ajax.BeginForm
all the input fields inside this form will be sent with the request and inside your action you will be able to rebind the model.
精彩评论