im having a problem passing a data to the controller in MVC3
I have a View that looks like this
@Ajax.ActionLink("MyController", "Myfunction", new {id =item.data},
new AjaxOptions
{
UpdateTargetId = "myDiv",
InsertionMode = InsertionMode.Replace,
})
<div id="myDiv"> </div>
And a controller that looks like this
public ActionResult Myfunction(string data)
{
//some code
return PartialView(chart);
}
It all kinda works but the data dont get into the controller (its null when i set a breakpoint), when i hover over the link i see the data in the adressfield. do i have to make some adjustment in the routingtable?
Any input is appreciated.
Change this line:
to be:
The variable names declared in the POST need to match that captured by the server, in other words your
Controller Action methodis expecting a parameterdataand its getting passedid