Enabled = False disables controls on all pages. Why?

B

Bisser Milanov

I have
1. A main form with 2 buttons (btn1 and btn2) and a place holder (ph)
2. A Web User Control (ctl1) containing a textbox (txt)
3. A Web User Control (ctl2) containing a textbox (txt)

When I press btn1 I have the following code:
ph.Controls.Add(LoadControl("ctl1.ascx"))

When I press btn2 I have the following code:
ph.Controls.Add(LoadControl("ctl2.ascx"))

In ctl1 I have the following line on form load:
txt.Enabled = False


When I press btn1 ctl1 is loaded and the txt is disabled. When I press btn2
ctl2 is loaded and the txt is disabled. Why the txt on ctl2 is disabled? and
how can I avoid it? Somehow it rememberd the state of the textbox from the
previous loaded page. Why?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top