Monday, March 26, 2012

load a report with a parameter...

I have a parameter on my report.

the report show someting in the load event.

the code in Load_ event is something like this:
{
m_strCode=txtCode.Text;
repDoc.SetParameterValue("stringP",m_strCode);
repDoc.SetDataSource(dsCodes1);
repViewer.ReportSource-repDoc;
repViewer.RefreshReport();
}

also i reload the Data when i push the button,so the code is the same:

Button1_click(...)
{
m_strCode=txtCode.Text;
repDoc.SetParameterValue("stringP",m_strCode);
repDoc.SetDataSource(dsCodes1);
repViewer.ReportSource=repDoc;
repViewer.RefreshReport();
}
also there is 2 lines in the repViewer_ReportRefresh(....)
{
repDoc.SetParameterValue("stringP",m_strCode);
repViewer.ReportSource=repDoc;
}

The problem is that,if i put this code in Load_ event too as shown above, because i want to show the data with that parameter on report, from the start, it still ask me to gave to the report the parameter.WHY?

ThanksYou need to supply the parameter value if any. Otherwise you have to suppress the popup by setting enable popup property to false|||I have supplied the value, if you follow closely the code, at the beginning of the message, i wrote, the LOAD event, where i give the parameter value.so even if i suply value, still ask me,for value.this was the problem! why?|||If you supply parameter values, you wont be prompted to give them. Open the report and do verify database

No comments:

Post a Comment