Hi. I need to be able to pass a few variables on a button click to refill a
form on a new page. I am using a few textbox's but when the button is
clicked the values are lost - I am convinced that these variables are being
disposed - but why? - and how can I fix it.
thanks
JamesJames,
Check that EnableViewState is set to True in the page directive.
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
And make sure you're not resetting the values in your Page_Load by testing
for !IsPostBack before initializing any values. Keep in mind that Page_Load
runs before your button event.
Dale
"James" <James@.REMOVEMEtamarsolutions.co.uk> wrote in message
news:cahrpo$4lt$1@.newsg1.svr.pol.co.uk...
> Hi. I need to be able to pass a few variables on a button click to refill
a
> form on a new page. I am using a few textbox's but when the button is
> clicked the values are lost - I am convinced that these variables are
being
> disposed - but why? - and how can I fix it.
> thanks
> James
>
James,
Yes as Dale states, it's important to check you're not wiping out your
hard work in the Page_Load event! But make sure the order of your
events is right too, use the Trace to check, but as a rule of thumb,
try and do all page specific stuff in the PreRender event.
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment