开发者

Asp.net MVC Ajax.ActionLink send ViewData.Model to the Action with last User inputs

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.

开发者_如何学Go

I 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜