IsPostBack not working

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?
 
R

Ray at

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
 
G

Guest

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
 

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

Top