开发者

stuff viewmodel into html.actionlink

Is there a way to stuff my ViewModel into an Ajax.ActionLink?

edit I'd like to ta开发者_运维问答ke 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


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.


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() ) %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜