I have page called default.aspx Where I have link to view report called adddrop.aspx So when I click on report link I should see two dropdown one with startdate and second with enddate. Now When I click on to view link report I am getting error " String Was not recognized as valid DateTime.
Please see the code below for Better idea..
vb
If Len(Request("startDate")) > 0 And Len(Request("endDate")) > 0 Then
SetData(Date.Parse(Request("startDate")), Date.Parse(Request("endDate")))
End If
' Response.Write(Request("startDate"))
' Response.Write(Request("endDate"))
If Not Page.IsPostBack Then
WriteToSiteLog()
End If
End If
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
SetData(CDate(dcStartDate.Value), CDate(dcEndDate.Value))
End Sub
Private Sub ExcelExport_ExcelExport_Click() Handles ExcelExport.ExcelExport_Click
ExcelExport.ExportToExcel(grdResult, Me.lblTitle.Text)
End Sub
#Region "Private Methods"
Private Sub SetData(ByVal startDate As Date, ByVal endDate As Date)
Dim ds As DataSet
Dim sRptType As String
Try
acSum = New wsACSummary.Summary
sRptType = Request("rptType")
'If String.Compare(Request("rptType"), "Added") = 0 Then
If String.Compare(sRptType, "Added") = 0 Then
ds = acSum.GetRegionMemJoined(connString, startDate, endDate)
ds.Tables(0).TableName = "regions"
ds.Tables.Add(acSum.GetMembersJoined(connString, startDate, endDate).Tables(0).Copy)
ds.Tables(1).TableName = "MembersAdded"
ds.Tables.Add(acSum.GetMembersAddedCount(connString, startDate, endDate).Tables(0).Copy)
lblTitle.Text = ds.Tables(1).Rows.Count & " Facilities Added "
lblReason.Text = "Summary of New Patrons"
Else
ds = acSum.GetRegionMemDropped(connString, startDate, endDate)
ds.Tables(0).TableName = "regions"
ds.Tables.Add(acSum.GetMembersDropped(connString, startDate, endDate).Tables(0).Copy)
ds.Tables(1).TableName = "MembersDropped"
ds.Tables.Add(acSum.GetMembersDroppedCount(connString, startDate, endDate).Tables(0).Copy)
lblReason.Text = "Reason for Dropping"
lblTitle.Text = ds.Tables(1).Rows.Count & " Facilities Dropped "
End If
dcStartDate.Value = startDate
dcEndDate.Value = endDate
'dcStartDate.Value = Date.Now
'dcEndDate.Value = Date.Now
dlReasonCount.Visible = True
dlReasonCount.DataSource = ds.Tables(2)
dlReasonCount.DataBind()
ds.Relations.Add("myrelation", ds.Tables(0).Columns("reg_name"), _
ds.Tables(1).Columns("reg_name"))
dlRegions.DataSource = ds
dlRegions.DataBind()
If ds.Tables(2).Rows.Count > 0 Then
lblReason.Visible = True
EnableExportLink(ds, sRptType)
Else
'lblReason.Visible = False
lblReason.Text = "There is no data available for this search"
Me.ExcelExport.btnExport.Visible = False
End If
Catch ex As Exception
Throw ex
End Try
End Sub
Thanks
Mod Edit: Please use code tags when posting your code, like so =>

Thanks,
PsychoCoder