User-1955664820 posted
Hi Everyone,
I'm trying to pass two date parameters to a Reporting Services report. On the first aspx page, the user selects begin date and end date parameters. Next, I have a linkbutton on that page that when clicked creates a query string and redirects
to the page with the Reporting Services report on it. My problem is that I can't pass the date parameters to the report directly. What is happening is the page opens and has the two date parameter boxes (Begin Date and End Date) which are empty - prompting
you to re-enter the dates. If I select dates from the calendar icon and click View Report, then the report runs fine however want to avoid this step. I want the dates to pass directly to the report and run via the query string. The date format when selected
on the first page is: 'mm/dd/yyyy'.
Here is my code on the sending page:
Protected
Sub LinkButton1_Click(ByVal
sender As
Object,
ByVal e
As System.EventArgs)
Handles LinkButton1.Click
Dim
targetURL As
String
Dim dtStartDate
As
Date
Dim
dtEnddate As
Date
dtStartDate = Me.txtBeginDate.Text
dtEnddate = Me.txtEndDate.Text
targetURL = "rptUpdateToHP3000.aspx?"
targetURL &= "SearchByBeginDate="
& Server.UrlEncode(dtStartDate)
targetURL &= "&SearchByEndDate="
& Server.UrlEncode(dtEnddate)
Response.Redirect(targetURL)
End
Sub
This is what my query string looks like on the receiving page:
http://localhost:2469/StateTag/rptUpdateToHP3000.aspx?SearchByBeginDate=6%2f1%2f2011&SearchByEndDate=6%2f5%2f2011
Does anyone know how to get this working correctly? Any help is appreciated.
Thanks.