Hi All,
Is there a way to stuff my ViewModel into an Ajax.ActionLink?
edit I'd like to take my 5 search fields on my page which are bind to a view model and send it along my .ActionLink as my object value parameter.
Thanks, rod
Hi All,
Is there a way to stuff my ViewModel into an Ajax.ActionLink?
edit I'd like to take my 5 search fields on my page which are bind to a view model and send it along my .ActionLink as my object value parameter.
Thanks, rod
This will create a link with url parameters from your model:
<%= Ajax.ActionLink("Link Text", "View", "Controller", new { urlParam = Model.Param1, urlParam2 = Model.Param2}, new AjaxOptions() ) %>
Instead of using Ajax.ActionLink, can't you use a normal submit button inside your form? You could even style it as a link if you use <input type="image" .... This way when the user clicks on the button it will submit the whole form together with the search values. Then ajaxify the form with Ajax.BeginForm.
To avoid polluting your markup with javascript, I would strongly recommend you using the more unobtrusive jQuery framework instead of Microsoft Ajax.