473,320 Members | 1,883 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,320 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 2015
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.