Home > DeveloperSection > Forums > Cant get input parameter to controller, Ajax.ActionLink
Jayden Bell
Jayden Bell

Total Post:105

Points:739
Posted on    April-16-2013 1:42 AM

 ASP.NET MVC ASP.NET MVC 
Ratings:


 1 Reply(s)
 3891  View(s)
Rate this:
Hi Everyone!

<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    @Ajax.ActionLink("Save", "Index", "Home", new AjaxOptions { UpdateTargetId = "saveResult" }, new { id = "1001" })
    <div id="saveResult">
</div>

Controller

public ActionResult Index(string id)
        {
            return View();
        }

Thank in advance!


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    April-16-2013 8:25 AM

Hi Jaden!

You are calling "UpdateTargetId" before passing parameter, that wrong way

Relpace your Ajax.ActionLink from below

@Ajax.ActionLink("Save", "Index", "Home", new { id = "1001" }, new AjaxOptions { UpdateTargetId = "saveResult" })

I hope it resolve your problem.

Don't want to miss updates? Please click the below button!

Follow MindStick