i'm working on windows forms application want load reports reportviewer after click on button. event gets triggered pressing on button in code behind of windows form:
private void button1_click(object sender, eventargs e) { telerik.reporting.instancereportsource reportsource = new telerik.reporting.instancereportsource(); reportsource.reportdocument = new reportlibrary.report1(); reportsource.parameters.add(new telerik.reporting.parameter("ordernumber","123456789")); reportviewer1.reportsource = reportsource; reportviewer1.refreshreport(); }
the problem have no idea how can access / parameter added before refreshing reportviewer. report has set datasource. don't know if matters. have right now. i've tried , i'm not getting further.
public report1() { initializecomponent(); position[] = new position[]{ new position("test", "test","test"), }; this.datasource = all; messagebox.show("number: " + this.report.reportparameters["ordernumber"].value.tostring()); }
is there way parameter straight after initializecomponent(); ? need add event report access it? if yes on best way this?
any apreciated. thank you
set parameters of report on instance of report (not report source), such as:
toppageviews report = new toppageviews(); report.reportparameters["startdate"].value = new datetime(2013, 3, 1); report.reportparameters["enddate"].value = new datetime(2013, 3, 1); instancereportsource reportsource = new instancereportsource(); reportsource.reportdocument = report; this.reportviewer1.reportsource = reportsource; this.reportviewer1.refreshreport();
in report constructor, after initializecomponent, subscribe handler itemdatabinding event:
this.itemdatabinding += toppageviews_itemdatabinding;
and in handler, can obtain value would:
datetime startdateparm = (datetime)this.reportparameters["startdate"].value;
you can use debugger see value.
Comments
Post a Comment