Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error making a data set transparent between pages

Status
Not open for further replies.

vgwprja

Programmer
Mar 27, 2008
24
0
0
US
I have a web page that displays a gridview (page 1). On this page I have a button saying "View Report" (link to page 2) and the intent is to render a new page showing a crystal report with same content as in the girdview on page 1.

Not sure how to navigate from page 1 to page 2, here is what I have and it seems to work:

Code:
Protected Sub ViewReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ViewReport.Click

Server.Transfer("ViewComparisonReport.aspx", True)

End Sub


Now, I plan to use the dataset (mySqlDataSet) that I used to fill the gridview to fill my Crystal Report and need make this data set transparent to page 2 where I will bind the data set to crystal report, not sure how to do this but here is what I have:

Code:
Dim myDataSet As New Data.DataSet
myDataSet = Request.Form("mySqlDataSet")

I get an error: "Value of type 'String' cannot be converted to System.Data.Datset
 
Code:
myDataSet = CType(Request.Form("mySqlDataSet"), DataSet)

Should work.
 
The dataset will not be a Form value. You will have to pass it using a session variable. You could use cache also, but that would be overkill.
 
I tried this:

Dim myDataSet As New Data.DataSet
myDataSet = CType(Request.Form("mySqlDataSet"), Data.DataSet)

Still got the same error.

What is the approach to using a session variable?

Thank you.
 
'Save your ds in session
Session.Add("yourDS")

'Read your ds from session
If Not IsNothing(Session.Item("yourDS")) Then
dim mydataset as new dataset = directcast(session.item("yourds"))

End If

 
Sorry I missed the Form value portion, thought (assumed) it was a session variable.

Will not answer until I'm completely awake in the mornings again :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top