Server.transfer and public variables

A

Amar

After using Server.Transfer to transfer data from one page
to another, I would like to know if there is a way to keep
the receiving web page variables intact after a postback.

Here is the code from the "sending" page:
<code>
Public ReadOnly Property SelectedDate() As Date
Get
Return Calendar1.SelectedDate
End Get
End Property
..
..
..
Server.Transfer("SignUp.aspx")
</code>

Here is the code in the receiving page:
<code>
Protected SelectedDate As Date
Public clsCalendar As Calendar
..
..
..
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then
clsCalendar = CType(Context.Handler, Calendar)
SelectedDate = clsCalendar.SelectedDate
Session.Item("dteSelectedDAte") = CType(SelectedDate, Date)
End Sub
</code>

I am forced to place the property SelectedDate into a
Session variable (Session.Item("dteSelectedDAte") = CType
(SelectedDate, Date)
) because after the postback, I lose access to the
receivning varaible (SelectedDate) which was transferred
from the original page. Now, however, after a postback,
the sending page is the same page, not the original.

Thanks in advance,
Amar
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top