Passing Data

D

Dot Net Daddy

Hello,

I want to pass the Calendar.SelectedDate to another page. But I dont
want to do it with either in the QueryString or HiddenField. Is there
another approach you can come up?

Thanks in advance.
 
G

Guest

You can use sessions this is a solution that work on both ASP.NET 1.x and
ASP.NET 2.0
the other solution is useing Cross Page Post Back. this will transfer you
page viewstate to the postback page target.
You use this by doing the following:
1)Set the PostBackUrl property of your button to the target Page
2) in your target Page use PreviousPage to get your control value like this:
DateTime dtm = (Calendar)PreviousPage.FindControl("Calendar1").SelectedDate;

make sure that you check for PreviousPage is not NULL before use it.

Hope this would help
Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 
D

Dot Net Daddy

Thank you for your help.

I first tried to use the 2nd solution, cross page post backs, which
looked easier to me (since I didnt have any information about
Sessions), but it didnt work. The part after the FindControl expression
was not recognized by the VS2005. and since I didnt know what to import
(Imports System. what?) I made a search and after reading, which
lasted about 2 minutes, an article about sessions now it works fine.

this is what I used, in case anyone wonders:

Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton2.Click
Session.("selectedDate") = Calendar1.SelectedDate
Response.Redirect(URL as String)
End Sub
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top