473,791 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to unload a usercontrol

My app is adding a usercontrol at runtime. How is it possible to remove this
usercontrol? Have tried Page.Controls.R emove(UserContr ol);, but that wont do
the trick - any suggestions?

-Lars

Nov 15 '05 #1
2 9688
Lars,

At what point are you trying to remove the control? Once you have
written to the response stream, you really can't take it back (unless you
are buffering). Are you doing anything that might commit the control to the
stream before you are rendering it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Lars Pedersen" <lsp*_AT_*oncab le.dk> wrote in message
news:ub******** ******@TK2MSFTN GP11.phx.gbl...
My app is adding a usercontrol at runtime. How is it possible to remove this usercontrol? Have tried Page.Controls.R emove(UserContr ol);, but that wont do the trick - any suggestions?

-Lars

Nov 15 '05 #2
Nicholas,

I'm just using a placeholder as a container for the usercontrol. In a
buttonclick event I'm adding a usercontrol to the placeholder, and at some
point, another control will be added to the placeholder, and then the first
usercontrol should be removed from the placeholder.

Is there maybe a way to make it invisible?
-Lars

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> skrev i
en meddelelse news:u9******** **********@TK2M SFTNGP11.phx.gb l...
Lars,

At what point are you trying to remove the control? Once you have
written to the response stream, you really can't take it back (unless you
are buffering). Are you doing anything that might commit the control to the stream before you are rendering it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Lars Pedersen" <lsp*_AT_*oncab le.dk> wrote in message
news:ub******** ******@TK2MSFTN GP11.phx.gbl...
My app is adding a usercontrol at runtime. How is it possible to remove this
usercontrol? Have tried Page.Controls.R emove(UserContr ol);, but that

wont do
the trick - any suggestions?

-Lars


Nov 15 '05 #3

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

Similar topics

5
20857
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I get the program to recognize that its window has been closed and quit running? -Harry http://home.netcom.com/~hjsmith
0
4089
by: razheev | last post by:
Hi, I have a Table which contains 1 million rows. I want to do an unload of the table and do some massaging (tranforming) of data and do a load to a different table where the column attributes are different. My question is 1) What options should I use to do a unload so that the unload is very fast using Platinum Fast unload. The table has many columns which defined as VARCHAR. 2)Is there a provision to convert the column values from...
1
2654
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body of my page in javascript. However, if I turn on smart navigation, any button that does a server.transfer fails to fire the javascript unload event.
1
2934
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to the unload event (client side not server side) of the <body> HTML element through javascript.
3
8525
by: buran | last post by:
Dear ASP.NET Programmers, I am loading a web user control ("taclient.ascx") into a placeholder (ID: phFA). The web user control contains a cancel button (ID: btnCancel). I would like to "unload" the web user control when the user clicks on the cancel button. How can I accomplish this? Thanks in advance. dim myControl as Control myControl = LoadControl("taclient.ascx") phFA.Controls.Clear()
2
2178
by: cindy | last post by:
I have a web form with 3 links, depending on which link is clicked a user control loads, page1.ascx,page2.ascx,page3.ascx page1.ascx does a search, uses 3 asp:dropdownlists with viewstate true and auto post back. It loads by default first time. User clicks on link 2, page2.ascx loads after page1.ascx I need the loaded control to go away when a different one is clicked, I have seen similar stuff on threads but I can't understand a...
3
3214
by: Gauthier Segay | last post by:
Hello, I've an application where all my pages implement a PAGE_CODE string property, this property is stored in HttpContext.Current.Items. In some page, I must persist data in session while the user perform operation on this page (postback navigation based). I also need to clean up the session data when the user leave the page (by a anyway). My question is about the Unload event, is it safe to use the unload
11
8658
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can do a Load too, but not an Unload. I just want the only the data from the table in a record sequential file. Export seems only to give options to have a delimited line sequential file or a record sequential file where the data is preceeded by...
6
4728
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the existing user control and load the newly selected one is pretty bulky. Every time we add a new user control to the project, we have to add some code in the section where we are loading/unloading. Is there a more dynamic, more efficient way to...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6770
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
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 we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.