Using Server.Transfer with HyperLinkColumn in a datagrid

E

Elton Wang

Hi Jason,

Without more detailed info, it's hard to say what's wrong
in you application.

Personally, I don't think it will cause trouble to pass
any data to the second page without using Server.Transfer.

Elton Wang
(e-mail address removed)
 
E

Elton Wang

First of all, you should understand the web application is
completely different from windows application. It's so
called stateless that means once you move from one page to
another page the first page is disappeared. You can't
refer to it and of course, can't get any data from it.
When you go back to the first page, it actually re-
initializes a new instance.

In order to transfer data between pages within an
application, you can use ApplicationState, SeesionState,
ViewState, or Cookie to save data in these objects, and
then share the data in different pages. In your case, you
can use SessionState to save data in page1. Then in page2
retrieve the data from SessionState.

To save data to SessionState:
Session("keyName") = obj;

To retrieve data from SessionState:
ObjectType obj = (ObjectType)Session("keyName");

HTH

Elton Wang
 
E

Elton Wang

Of course, it's fine if you use query string to pass
parameters to second page.

In your case, you can use

page2.aspx?prop1=p1Value&prop2=p2Value

to access page2 from page1.

In page2, use

string p1 = Request.QueryString.Get("prop1");
string p2 = Request.QueryString.Get("prop2");

to retrieve those values.

HTH

Elton Wang
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top