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

Last post 11-10-2009 1:41 AM by KeFang Chen - MSFT. 2 replies.

Sort Posts:

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

    11-07-2009, 9:53 AM
    • Member
      10 point Member
    • abedijoo
    • Member since 05-02-2009, 6:21 AM
    • Posts 12

    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.

    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" })%>

    What shall i do?
    Filed under:
  • Re: Asp.net MVC Ajax.ActionLink send ViewData.Model to the Action with last User inputs

    11-08-2009, 2:26 PM
    Answer
    • Member
      496 point Member
    • SeanMcAlinden
    • Member since 10-05-2009, 9:57 PM
    • Crawley, UK
    • Posts 59

    Hiya,

    Sounds like you need to look at posting a form rather than using the action link - you can still do this via ajax - look up ajax.beginForm.

    Hope this helps.

    Kind Regards,

    Sean. 

    Please click "Mark as Answer" on this post if it helps you.

    Sean McAlinden - Senior Developer

    www.asp-net-mvc.com
  • Re: Asp.net MVC Ajax.ActionLink send ViewData.Model to the Action with last User inputs

    11-10-2009, 1:41 AM
    Answer

    Hi,

    It seems that you want to send the updated model object to the action "MyAction".

    If in this case, I think the "ViewData.Model" is not suitable for the situation. The "ViewData.Model" return the originate object which was sent to view to render the "edit view" from your action.

    AS Sean suggested, you can use Ajax.BeginForm to post all the form field to action.

Page 1 of 1 (3 items)