473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

User controls and disappearing values

Jim
I have a user control that I am dynamically loading into an aspx page. When
I fill out the text boxes and submit the form using a command button on the
aspx page I lose the value from the user control. I have an Error-checking
function in the user control that I invoke from the aspx page. This method
fires and detects an error even though I fill the the text box with text.
Now, if I fill out the text box again with text everything goes smooth
sailing and I am able to continue. I am loading the user control using the
following methodology:

tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control

pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
panel
userBehaveProblem.HasErrors ();//the method call

I think it is a state problem, and I have the view state enabled. Any
suggestions?

Nov 18 '05 #1
6 1792
Jim, behind what event are you loading the user control, and are you doing it
on every postback?

"Jim" wrote:
I have a user control that I am dynamically loading into an aspx page. When
I fill out the text boxes and submit the form using a command button on the
aspx page I lose the value from the user control. I have an Error-checking
function in the user control that I invoke from the aspx page. This method
fires and detects an error even though I fill the the text box with text.
Now, if I fill out the text box again with text everything goes smooth
sailing and I am able to continue. I am loading the user control using the
following methodology:

tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control

pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
panel
userBehaveProblem.HasErrors ();//the method call

I think it is a state problem, and I have the view state enabled. Any
suggestions?

Nov 18 '05 #2
Jim
I am loading the controls off of a combo box post back, but I am not
reloading the user control after the command button click event is fired. I
assumed since I declare the user controls as being form level I would not
have to.

"Bill Borg" wrote:
Jim, behind what event are you loading the user control, and are you doing it
on every postback?

"Jim" wrote:
I have a user control that I am dynamically loading into an aspx page. When
I fill out the text boxes and submit the form using a command button on the
aspx page I lose the value from the user control. I have an Error-checking
function in the user control that I invoke from the aspx page. This method
fires and detects an error even though I fill the the text box with text.
Now, if I fill out the text box again with text everything goes smooth
sailing and I am able to continue. I am loading the user control using the
following methodology:

tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control

pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
panel
userBehaveProblem.HasErrors ();//the method call

I think it is a state problem, and I have the view state enabled. Any
suggestions?

Nov 18 '05 #3
If the control and its textbox are not there after postback, there's no place
for the text you just entered to return to. Try loading the control each
time. Curious, in this case, how are you invoking the error-checking function
after postback if that control doesn't exist?

Bill

"Jim" wrote:
I am loading the controls off of a combo box post back, but I am not
reloading the user control after the command button click event is fired. I
assumed since I declare the user controls as being form level I would not
have to.

"Bill Borg" wrote:
Jim, behind what event are you loading the user control, and are you doing it
on every postback?

"Jim" wrote:
I have a user control that I am dynamically loading into an aspx page. When
I fill out the text boxes and submit the form using a command button on the
aspx page I lose the value from the user control. I have an Error-checking
function in the user control that I invoke from the aspx page. This method
fires and detects an error even though I fill the the text box with text.
Now, if I fill out the text box again with text everything goes smooth
sailing and I am able to continue. I am loading the user control using the
following methodology:

tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control

pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
panel
userBehaveProblem.HasErrors ();//the method call

I think it is a state problem, and I have the view state enabled. Any
suggestions?

Nov 18 '05 #4
Jim
I think you may have misunderstood. The user control is there, just not the
value that I typed into the text box of the user control.

"Bill Borg" wrote:
If the control and its textbox are not there after postback, there's no place
for the text you just entered to return to. Try loading the control each
time. Curious, in this case, how are you invoking the error-checking function
after postback if that control doesn't exist?

Bill

"Jim" wrote:
I am loading the controls off of a combo box post back, but I am not
reloading the user control after the command button click event is fired. I
assumed since I declare the user controls as being form level I would not
have to.

"Bill Borg" wrote:
Jim, behind what event are you loading the user control, and are you doing it
on every postback?

"Jim" wrote:

> I have a user control that I am dynamically loading into an aspx page. When
> I fill out the text boxes and submit the form using a command button on the
> aspx page I lose the value from the user control. I have an Error-checking
> function in the user control that I invoke from the aspx page. This method
> fires and detects an error even though I fill the the text box with text.
> Now, if I fill out the text box again with text everything goes smooth
> sailing and I am able to continue. I am loading the user control using the
> following methodology:
>
> tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
> tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
>
>
> userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
> tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control
>
> pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
> panel
>
>
> userBehaveProblem.HasErrors ();//the method call
>
> I think it is a state problem, and I have the view state enabled. Any
> suggestions?
>

Nov 18 '05 #5
If I'm understanding you right, you are doing the loadcontrol in the
selectionchanged event of the combo box (autopostback=true), e.g.

panel1.Controls.Add(LoadControl("test.ascx"))

Is that right? If so, that control only *looks* like it's there (you see it
on the screen), but it's not *really* there after the next postback (e.g. the
button click), because everything starts from scratch again on the page load.

Not sure if you have a wide variety of user controls you're adding, but if
the number is small you might consider putting them *all* on the panel at
design-time, then let your combobox set visible on/off for the ones you want.

Let me know if this helps or if I'm still missing something.

Bill

"Jim" wrote:
I think you may have misunderstood. The user control is there, just not the
value that I typed into the text box of the user control.

"Bill Borg" wrote:
If the control and its textbox are not there after postback, there's no place
for the text you just entered to return to. Try loading the control each
time. Curious, in this case, how are you invoking the error-checking function
after postback if that control doesn't exist?

Bill

"Jim" wrote:
I am loading the controls off of a combo box post back, but I am not
reloading the user control after the command button click event is fired. I
assumed since I declare the user controls as being form level I would not
have to.

"Bill Borg" wrote:

> Jim, behind what event are you loading the user control, and are you doing it
> on every postback?
>
> "Jim" wrote:
>
> > I have a user control that I am dynamically loading into an aspx page. When
> > I fill out the text boxes and submit the form using a command button on the
> > aspx page I lose the value from the user control. I have an Error-checking
> > function in the user control that I invoke from the aspx page. This method
> > fires and detects an error even though I fill the the text box with text.
> > Now, if I fill out the text box again with text everything goes smooth
> > sailing and I am able to continue. I am loading the user control using the
> > following methodology:
> >
> > tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
> > tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
> >
> >
> > userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
> > tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control
> >
> > pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
> > panel
> >
> >
> > userBehaveProblem.HasErrors ();//the method call
> >
> > I think it is a state problem, and I have the view state enabled. Any
> > suggestions?
> >

Nov 18 '05 #6
Jim
Yah, I have approximately 40 different controls that I need to be able to
load, so I will just come up with something in the command button click
event. Thanks for all of your help, however.

"Bill Borg" wrote:
If I'm understanding you right, you are doing the loadcontrol in the
selectionchanged event of the combo box (autopostback=true), e.g.

panel1.Controls.Add(LoadControl("test.ascx"))

Is that right? If so, that control only *looks* like it's there (you see it
on the screen), but it's not *really* there after the next postback (e.g. the
button click), because everything starts from scratch again on the page load.

Not sure if you have a wide variety of user controls you're adding, but if
the number is small you might consider putting them *all* on the panel at
design-time, then let your combobox set visible on/off for the ones you want.

Let me know if this helps or if I'm still missing something.

Bill

"Jim" wrote:
I think you may have misunderstood. The user control is there, just not the
value that I typed into the text box of the user control.

"Bill Borg" wrote:
If the control and its textbox are not there after postback, there's no place
for the text you just entered to return to. Try loading the control each
time. Curious, in this case, how are you invoking the error-checking function
after postback if that control doesn't exist?

Bill

"Jim" wrote:

> I am loading the controls off of a combo box post back, but I am not
> reloading the user control after the command button click event is fired. I
> assumed since I declare the user controls as being form level I would not
> have to.
>
> "Bill Borg" wrote:
>
> > Jim, behind what event are you loading the user control, and are you doing it
> > on every postback?
> >
> > "Jim" wrote:
> >
> > > I have a user control that I am dynamically loading into an aspx page. When
> > > I fill out the text boxes and submit the form using a command button on the
> > > aspx page I lose the value from the user control. I have an Error-checking
> > > function in the user control that I invoke from the aspx page. This method
> > > fires and detects an error even though I fill the the text box with text.
> > > Now, if I fill out the text box again with text everything goes smooth
> > > sailing and I am able to continue. I am loading the user control using the
> > > following methodology:
> > >
> > > tenant_setup.scheduling.userbehaveproblems userBehaveProblem = new
> > > tenant_setup.scheduling.userbehaveproblems();//form level variable declaration
> > >
> > >
> > > userBehaveProblem = LoadControl ("userbehaveproblems.ascx") as
> > > tenant_setup.scheduling.userbehaveproblems;//gets an instance of the control
> > >
> > > pnlUserControl.Controls.Add (userBehaveProblem);//loads the control in the
> > > panel
> > >
> > >
> > > userBehaveProblem.HasErrors ();//the method call
> > >
> > > I think it is a state problem, and I have the view state enabled. Any
> > > suggestions?
> > >

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
4
by: Steve | last post by:
Hi All, I've seen many postings regarding different situations where controls disappear but have never seen a decent solution. Here is the problem. I have a form onto which I am placing some...
2
by: Rachel Suddeth | last post by:
Here is my scenario: I have a few custom controls that I set up on a form and tested setting properties and appearances. Then I added a couple references to the project which add classes I need to...
3
by: Oddball | last post by:
How on earth do I convince VS.net to keep stop removing my user controls from the design view! I've created my very own listbox and now I go to put in into the form - which works - I wonder off...
1
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new...
7
by: clintonG | last post by:
Hello Fellow Masochists ;-) In the MasterPage I've used a control (LinkButton1) in the 'header' region to function as a tab that displays another control (LinkButton2). LinkButton2 is located...
6
by: George Yefchak | last post by:
Hi folks, What's the latest news on the "disappearing controls" issue? I've seen a few posts over the last several months indicating that other people have the same problem, but I've seen...
3
by: ARayB | last post by:
We've suddenly had all of the controls, user and otherwise disappear from their containing form in VS2005 (SP1). The form included a grid, labels, tab control and a number of instances of a user...
1
by: JDeats | last post by:
I have many labels that are disappearing from my form when the user resizes it, they seem to dissapear when certain width/height thresholds are exceeded. I have no code in place purposely trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.