I am having issues with passing an argument from my view to my controller
I have this code fragment in my view:
<a class="btn-simple" onclick="submitDetails('Dashboard', 'Cancel', '<%=Model.Data.Id %>', $('form'));">save</a>
and this is from my controller:
[HttpPost]
public ActionResult Cancel(string id, FormCollection collection)
{
var appt = Application.Session.GetObjectFromOid<Appointment>(new ObjectId(id));
}
I get an error saying that "id" is null, but when I test Model.Data.Id in the view, it is not null.
And this is my submitDetails function:
function submitDetails(controller, method, id, form) {
form.ajaxSubmit({ target: '#itemdetails' });
}
What I am trying to accomplish is getting back to my controller from a button in the view, the "[HttpPost]" version of the method that originally called the view
submitDetails()code.submitDetailsdo?<%=Model.Data.Id %>- Are you sureModel.Dataisn't null?