Showing posts with label aspx. Show all posts
Showing posts with label aspx. Show all posts

Friday, March 30, 2012

Passing NULL parameter from aspx page to Report Server

Hi,

I was wondering if anyone here could help me out. I have an aspx page that has the ReportViewer control on it. I have a report that has 3 parameters used for a stored procedure. One of the parameter is a datetime parameter and it can be null. For the purposes of this iteration of the report, this parameter needs to be null.

I can not for the life of me figure out how to send over a null parameter from the aspx page. Everything I have tried gives me this error: "The value provided for the report parameter 'StartDate' is not valid for its type. (rsReportParameterTypeMismatch) "

I tried to send the parameter as "&StartDate:isnull", but that did not work. Neither did: "&StartDate=", "&StartDate=NULL", "&StartDate=<NULL>"

I'm reaching my wits end. I can't seem to find any information anywhere about sending a null parameter to ReportServer via the ReportViewer.

Any help would be greatly appreciated.

I can't find out how to pass NULL as the parameter for the report, either. The report server is based in VB, so it uses Nothing instead of Null, but I can't get it to take that, either. I'm not sure how you have the report set up, or what else you are using it for, but it may be easier if you could set NULL as the default value, and then just not pass in the date parameter.

|||

I tried a sample snippet and its working,

ReportParameter rp1 =

newReportParameter("param2",newstring[] {null },false);

Add it to reportviewer control

List<ReportParameter> paramList =newList<ReportParameter>();

paramList.Add(rp2);

ReportViewer1.LocalReport.SetParameters(paramList); //replace local with server report if you are hostin your reports on reporting server

there you go on report side you can check

=IIF( IsNothing(Parameters!param2.Value),"Null value","not nul")

|||

Unfortunately, I can't get the NULL to set for a default parameter in the report either. I tried, setting it equal to:

=NULL
=null
=System.DBNull
=DBNull
=isnull
=:isnull
:isnull
<NULL>
=""
=
just plain leaving it blank

I have noticed that the when going through preview, the checkbox for NULL is checked. But if I run the report, it is not defaulted to a checked state.

It seems like there would be some information about this somewhere. I have a hard time believing that no one has really found this to be an issue before.

Thanks in advance for your help

|||

It looks like sundher_ganesh has come up with a working solution for sending a null value to the report. If you want a default value of null for the report, you can do one of the following:

In the report designer (At least in VS 2005) you can select Null for the default value (It's one of the three radio buttons).

Otherwise, "=Nothing" (without the quotes, of course), works for the default expression.

|||

Benners_J:

It looks like sundher_ganesh has come up with a working solution for sending a null value to the report. If you want a default value of null for the report, you can do one of the following:

In the report designer (At least in VS 2005) you can select Null for the default value (It's one of the three radio buttons).

Otherwise, "=Nothing" (without the quotes, of course), works for the default expression.

Yes, he did. I guess we posted around the same time. Thanks so much sundher_ganesh and Benners_J for your help.

Monday, March 12, 2012

Passing a queryString to RDLC Help

I have this problem. Can someone enlightened me on how to pass a querystring to a rdlc report?

I have a aspx page "Quotation". When my user wants to print out a quotation hardcopy, he will click on an icon (it will go to Quotationhardcopy.aspx which contains the rdlc report) to print out the report. But, I am struck in how to pass the field "QuoteID" to the rdlc report so that it will only print out this quotation belonging to the quoteID..

Can someone advice me on that?

Smile
chankl78

Finally, i solved it. It is so simple & it take me almost 2 days to solve.

Just put the code inside the page Load & it works!!! :cheers:

[CODE]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim txtQuoteID As Label
Dim paraQuoteID As ReportParameter
Dim QuoteID As Integer

txtQuoteID = fvQuotation.FindControl("QuoteIDLabel")
QuoteID = txtQuoteID.Text
paraQuoteID = New ReportParameter("QuoteID", QuoteID)

Me.rvQuotationHardcopy.LocalReport.SetParameters(New ReportParameter() {paraQuoteID})
End Sub
[/CODE]

Wednesday, March 7, 2012

Pass Report Globals to Default.apsx Through URL

Hello,

Does anyone know how to pass report globals in "Jump to URL" to a .aspx site through URL? Thanks for any effort to help out?

Nevermind, got it.