IsPostBack not working

  • Thread starter Thread starter Blue Man
  • Start date Start date
B

Blue Man

Hello
My page is generated by a user control, I check IsPostBack condition in user
control Page_Load event.
if(this.IsPostBack)
clearcontrols();

clearcontrol disables all of textboxs and buttons. but seems not working.
when ever i push back button from my browser i can see all of them still
enabled.
I tried if(IsPostBack),if(page.ispostback) and if(this.page.ispostback)
also, but didn't work.
what is wrong with my code?
 
Postback isn't when you press the back button on your browser. Postback is
when you submit the form from pressing submit or any element that does a
document.form.submit();

Ray at work
 
If you want to call clearControls() everytime a page loads for the first time you have to do it when it's not postback
Page.IsPostback will return false when the page/control is loaded for the first time

With the way you have it, it'll only clear controls when you submit the page

(i.e
if(!Page.IsPostback) clearcontrols()

HTH
Suresh


----- Blue Man wrote: ----

Hell
My page is generated by a user control, I check IsPostBack condition in use
control Page_Load event
if(this.IsPostBack
clearcontrols()

clearcontrol disables all of textboxs and buttons. but seems not working
when ever i push back button from my browser i can see all of them stil
enabled
I tried if(IsPostBack),if(page.ispostback) and if(this.page.ispostback
also, but didn't work
what is wrong with my code
 
Back
Top