473,503 Members | 3,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Usercontrol dynamically loaded (in Init method of webcontrol) have viewstate problems

I have a problem with a usercontrol that is dynamically loaded, from a web
control and is not restoring it's viewstate properly.

Here's the scenario. Within our content management system, I have a
webcontrol which allows a admin user to select a usercontrol to include
within a page when in "edit mode".

When a user is editing the page they see a dropdown list of available
controls and select one and save the page, kind of irrelevant to this
problem but it gives some background.

When the page is constructed to be served the webcontrol checks which
usercontrol has been selected in it's Init method and adds the
approprapriate usercontrol to the webcontrols' Controls collection.

When the usercontrol is loaded dynamically it loads a repeater on the page,
and it's contents should be stored in the viewstate. However when a
postback is carried out the contents of any controls within the dynamically
loaded usercontrol are lost.

Any help or advice on this greatly appreciated. Please note the controls
are loaded in the Init method of the webcontrol, so before the Loadviewstate
method fires, and at the loadviewstate and saveviewstate methods are both
being called for the dynamically loaded usercontrol.

Thanks,

Matt
Nov 19 '05 #1
0 1514

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

Similar topics

1
1889
by: Joel Reinford | last post by:
I am working on an ASP.NET web app. One of the pages will be using several user controls. The controls will be loaded dynamically based on SQL Server data. I need to be able to retrieve the...
8
4296
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
13624
by: Josh | last post by:
Hi Guys, I have been having a big problem with trying to pass parameters into a user control when the user control is dynamically loaded into a placholder. I am developing in c#. I have get...
6
3350
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
3
1573
by: JB McMichael | last post by:
I have an aspx page that based on a query loads a user control dynamically. The aspx page is simple, just a place holder, the code behind queries a table that stores the names of the ascx files. ...
0
1155
by: Jesper Lund Stocholm | last post by:
I have problems with sending javascript to the client from a dynamically loaded usercontrol. I have a single page that dynamically loads controls into a table cell in a HTML-table. For one of...
1
1464
by: Alexey Smirnov | last post by:
I have a web form, which load a web control by using the LoadControl method void Page_Init(...) { Control ctl = LoadControl(Request.QueryString+".ascx"); // url = default.aspx?module=control1...
5
3065
by: Andrew Robinson | last post by:
I have a page that can load a number of different user controls. Each of these user controls inherits from a common base class and the controls are loaded based on application state, status, etc...
2
1947
by: Kerem Gümrükcü | last post by:
Hi, i have a (simple) dynamic plugin architecture and i want to call a member function from the dynamically loaded assembly and its instanciated class. The Code looks like this: foreach...
0
7192
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
7064
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
7315
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...
1
6974
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
7445
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...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.