Download CSV File by posting JSON data in ASP.NET MVC -
in asp.net mvc, trying download file via post , sending json data. json data filters data being displayed on page via knockout.js. critieria object null. how can download file, sending post data via javascript or form post? ive accomplished ajax download using get, have data, arrays need post.
form
<form method="post" action="@model.exporturl" > <input type="hidden" name="criteria" data-bind="value: ko.tojson(data())" /> <button class="btn"><i class="icon-download-alt"></i> export</button> </form>
request
request url:http://localhost:2222/members/eventteams/export?eventid=8998 request method:post status code:500 internal server error request headersview source accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-encoding:gzip,deflate,sdch accept-language:en-us,en;q=0.8 cache-control:max-age=0 connection:keep-alive content-length:128 content-type:application/x-www-form-urlencoded host:localhost:2222 origin:http://localhost:2222 referer:http://localhost:2222/members user-agent:mozilla/5.0 (windows nt 6.2; wow64) applewebkit/537.36 (khtml, gecko) chrome/28.0.1500.95 safari/537.36 query string parametersview sourceview url encoded eventid:8998 form dataview sourceview url encoded criteria:{"page":1,"pagesize":"100","sortorder":"team.name","sortdirection":"asc"}
controller
[httppost] public virtual actionresult export(int eventid, divisionteamstablecriteria criteria) {
you can try posting form iframe 1 how post iframe?
and on iframe asp.net page, write file response write csv file , export it?
- iframe can 1x1 pixels
Comments
Post a Comment