开发者

Pass formcollection to action without form submission

开发者 https://www.devze.com 2022-12-17 08:44 出处:网络
I have a link (well a few different links actually) that target FileContentPath actions that return pdf/excel files etc that are generated in the controller. problem is that I want these actions to re

I have a link (well a few different links actually) that target FileContentPath actions that return pdf/excel files etc that are generated in the controller. problem is that I want these actions to receive the formcollection as well that may be changing all the time depending on the users interaction with the page. Is there a workaround way to get the formcollection to开发者_Go百科 these action methods

i.e. I have links as below

<a href="/Home/GetPdf/42" id="btn_pdf_1">Get PDF</a>

and want to be able to pass some hidden fields to this through?


When you make a GET request the data is sent in the url. So if you want to send that data you need to do that in the url (as query strings).


You can change the path of the href to what ever you want. So you can get the values from form and add whatever needs adding to you paths. This does not need a form submitted you just need to set up a function for when the link or when the form is filled.

0

精彩评论

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

关注公众号