Hello All,
I will confess up front that I am both new and a student. (Oh and apologies if this has been posted in the wrong place).
I am not looking for code in particular but I have gotten myself into a bit of a hole as it where and I need helping hand towards the direction that is out :-)
I have two ASP pages running with C#. The first one has a couple of variables (One int and one string) which it passes to the second using the Server.Transfer method. However, on the second page there are a couple of Calendar objects and when the user clicks on either, the page is refreshed and the line in the code inside the "On_Page_Load" method suddenly looses all reclection of the page I passed the variables from and crashes.
The calendars themselves are also failing becuase of page refreshing, both default to the 01/01/01 and any time I try and set them, to todays date, it again causes havoc when the page refreshes.
I know the transfer works the first time around as I set up a couple of labels which would appear when the pages loads and they are quite happily displayed until the page is refreshed.
I hope I am not breaking any rules by asking this, I have tried working it out for myself but I think its time to wave the white flag of surrender.
Thanks for any/all help and apologies if this is in the wrong place. I'm new and I swear I am not trying to upset anyone.
Loading
Amit ChoudharyPosted Nov 26, 2009, 12:06 AM
this is right place and you are asking right problem...
Try set EnableViewState='true' of all controls which depends on your Server.Transfer Variables... or you can store the values in session object and you can retrieve them in page load event again from the session...
else
You can use Response.Redirect(); method supply the values you want to transfer from one page to next in the form of URL-Parameters so and retrieve them using Request.QueryString["NameVariable"].
If it solves you problem then mark the answer :) don't afraid to ask any problem.. this form is to provide solutions