Can I make OleDb data in one page available to another page

G

Guest

I'm fairly new to this ASPX/OLEDB stuff. I have an OleDbDataReader in one
..aspx page. I do a Server.Transfer to another page. Is it possible to make it
so that the data in the OleDbDataReader is available to the other page, so I
don't have to go back to the database?
 
K

Kevin Spencer

Hi Dave,

When you use Server.Transfer to transfer from one Page to another, the first
Page remains as the HttpHandler in the Context. So, you can access any
public value in the first Page class via something like the following:

FirstPageClass firstpage;
if (!IsPostBack) // Via Server.Transfer
{
firstpage = (FirstPageClass)Context.Handler;
}

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
 
G

Guest

Thanks Kevin. That works fine. However, it sems to only work in the Page_Load
event. I'd like to be able to get at the information in other places, like in
a button click event, but it doesn't seem to work. Do you know the trick for
this, or am I being too ambitious?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top