0

Please assist, I have the following Ajax code

@Ajax.ActionLink(linkText: "Call An Action",
                actionName: "GetCoverDate",
                routeValues: new { appd = Model.AppDate },
                ajaxOptions: new AjaxOptions
                {
                    UpdateTargetId = "ajaxtarget",
                    InsertionMode = InsertionMode.Replace
                })

My Controller Action

 public string GetCoverDate(DateTime appd)
    {

        return  appd.AddMonths(6).ToString();

    }

What this does is it takes the contents of Model.AppDate and adds 6 months to it via ajax and controller's method and displays the results in a div

I'm trying to have the following changes to the code.

  1. Insert the returned results (date) to the appropriate EditorFor (at the moment I'm displaying the result in a div - ajaxtarget)
  2. The routeValue as it is, passes a date that was set as default when the view was loaded, how do I pass the value currently contained on the EditorFor (in case the user has selected a different date)?

Thank you in advance

LMDev
  • 37
  • 1
  • 10
  • If you want to submit the value of a control, then you need to submit a form (not use a link) –  Feb 18 '16 at 00:03
  • This may help: [http://stackoverflow.com/questions/867253/how-can-i-pass-a-textboxes-value-to-my-ajax-actionlink](http://stackoverflow.com/questions/867253/how-can-i-pass-a-textboxes-value-to-my-ajax-actionlink) – Luke Narramore Feb 18 '16 at 11:07

0 Answers0