I have a web form. On it I am generating a gridview through a stored procedure. Now it has it's DataSource set to dataset object ds.
After generating this gridview. I want to generate an xls file. The code for that is correct. But since I am calling a separate function, dataset object does not exist there. So How to achieve a global daataset object. I tried declaring dataset obj at the top, but wont help !
Structure is somewhat like this:
partial class ..... Dim ds as DataSource = new Datasource() sub for gridview() gridview.datasource = ds end sub sub GetReport_Click () Handles GetReport.Click [code for excel sheet] [here i want to access same ds which has data that went in to gridview...but giving 'Object reference not set to instance of an onject' error] end sub End Class
P.s I tried putting DS object in session and retrieving it. That can be a solution. But what if I have hundreds of rows in my dataset? And if many users are there, wont memory consumption increase ? Can there be another more effiecient way ?