473,395 Members | 1,823 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.

LoadControl and PostBack

I am trying to build a tabbed-style interface to capture information about a
person. I have one control that captures info about the person and a second
webuser control that captures information about the departments to which the
person is assigned. When a user clicks a tab, the appropriate WUC is
displayed.

Currently, I'm loading the appropriate control when Not IsPostBack. This
makes sense when a querystring is used to access the aspx page or to change
tabs.

Unfortunately, when one of the WUC posts back, the WUC is not loaded.
Obviously, I can't update any information in the WUC as it isn't there.

Does a control need to be loaded during postbacks as well? I suppose I
could always load both controls and hide the inactive one, but this seems
like an unnecessary waste of resources. Is there a better way?

Thanks,

Craig Buchanan

Nov 18 '05 #1
1 2018
Hi Craig,

ASP.Net is stateless, which means that each Request occurs "in a vacuum" so
to speak. Once an ASPX page is processed, it is unloaded from memory.
Therefore, dynamically-added Controls must be dynamically added with each
PostBack.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:eM**************@TK2MSFTNGP09.phx.gbl...
I am trying to build a tabbed-style interface to capture information about a person. I have one control that captures info about the person and a second webuser control that captures information about the departments to which the person is assigned. When a user clicks a tab, the appropriate WUC is
displayed.

Currently, I'm loading the appropriate control when Not IsPostBack. This
makes sense when a querystring is used to access the aspx page or to change tabs.

Unfortunately, when one of the WUC posts back, the WUC is not loaded.
Obviously, I can't update any information in the WUC as it isn't there.

Does a control need to be loaded during postbacks as well? I suppose I
could always load both controls and hide the inactive one, but this seems
like an unnecessary waste of resources. Is there a better way?

Thanks,

Craig Buchanan

Nov 18 '05 #2

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

Similar topics

5
by: Kurt | last post by:
When I try to use LoadControl I get the error message below. Any help would be great. Kurt Control '_ctl0_Classification' of type 'TextBox' must be placed inside a form tag with runat=server
0
by: Craig Buchanan | last post by:
I am building a webform that dynamically loads one of two web usercontrols during the webform's page_load event. during the postback i reload the appropriate web usercontrol. so far so good. ...
1
by: Craig Buchanan | last post by:
i am building a webform that dynamically loads one of two web usercontrols during the webform's page_load event. during the postback i reload the appropriate web usercontrol. so far so good. ...
0
by: Leszek Taratuta | last post by:
Hello, I load a user control using Page.LoadControl(). The user control contains two web controls: a drop-down list and a text box. The problem is that the SelectedItem as well as Text...
6
by: John | last post by:
Hi all, I am using dynamic user controls within my web app and these controls are loaded into placeholders via the LoadControl method. My problem is this: I have usercontrolA loaded into a...
2
by: Sekhar | last post by:
Hi all I have one page WebForm1.aspx and one user control UserControl.ascx My WebForm1 has a Place holder and dropdownlist with autopostback property set to true. The user control also has a...
0
by: Carl Wright | last post by:
Hi I'm having this major issue loading a usercontrol at runtime using the overload on Loadcontrol(type,object). Here's the code in the aspx code-behind file Dim myControl As New Control Dim...
2
by: =?UTF-8?B?16jXnteZ?= | last post by:
Hey, I'm loading a webusercontrol dynamically using The following code: Control newCtrl = LoadControl("MyCtrl.ascx"); newCtrl.ID = "MyCONTROL"; container.Control.Add(newCtrl); My...
2
by: jack | last post by:
Hi folks, Consider a page consisting of a treeview, and a panel. The panel is supposed to be refreshed based on treeview node selection. protected void tree_SelectedNodeChanged(object sender,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.