model view controller - Passing parameters to rdlc file in mvc at runtime -
i created quite few rdlc reports in visual studio. have them exporting excel, pdf, image, , word. need set parameters @ runtime, user can define start date , end date field. field psurcvd. have added parameters startdate , enddate rdlc "holbrookreceived". not know how assign them psurcvd field , how prompt text boxes @ runtime date inputs. how do this?
here code in controller.
public actionresult holbrookreceivedreport(string id) { localreport lr = new localreport(); string path = path.combine(server.mappath("~/report"), "holbrookreceived.rdlc"); if (system.io.file.exists(path)) { lr.reportpath = path; } else { return view("index"); } list<tblpsu> cm = new list<tblpsu>(); using (psu_databasesqlentities dc = new psu_databasesqlentities()) { cm = dc.tblpsus.tolist(); } reportdatasource rd = new reportdatasource("holbrookreceiveddataset", cm); lr.datasources.add(rd); string reporttype = id; string mimetype; string encoding; string filenameextension; string deviceinfo = "<deviceinfo>" + " <outputformat>" + id + "</outputformat>" + " <pagewidth>8.5in</pagewidth>" + " <pageheight>11in</pageheight>" + " <margintop>0.5in</margintop>" + " <marginleft>1in</marginleft>" + " <marginright>1in</marginright>" + " <marginbottom>0.5in</marginbottom>" + "</deviceinfo>"; warning[] warnings; string[] streams; byte[] renderedbytes; renderedbytes = lr.render( reporttype, deviceinfo, out mimetype, out encoding, out filenameextension, out streams, out warnings); return file(renderedbytes, mimetype); } here view
<ul class="nav nav-pills nav-stacked"> <li> <div class="btn-group"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> ramona holbrook received <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="@url.action("holbrookreceivedreport", new { id = "pdf" })">pdf</a></li> <li><a href="@url.action("holbrookreceivedreport", new { id = "excel" })">excel</a></li> <li><a href="@url.action("holbrookreceivedreport", new { id = "word" })">word</a></li> <li><a href="@url.action("holbrookreceivedreport", new { id = "image" })">image</a></li> </ul> </div> </li>
take @ following , see if helps out. how pass textbox/combobox value rdlc report text field? , https://www.youtube.com/watch?v=859bmmvom8m
Comments
Post a Comment