473,800 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove control from another control

I have the following .aspx code:

<%@ Page Language="vb" AutoEventWireup ="false" Explicit="True"
Inherits="Whate ver.DefaultPage " CodeFile="Defau lt.aspx.vb" %>
<%@ Register TagPrefix="what ever" TagName="someth ing"
Src="~/Whatever/Whatever.ascx" %>
<asp:placeholde r id="fred" runat="server"> </asp:placeholder >
<whatever:somet hing id="something" runat="server" />

the Default.aspx.vb code adds some controls to the 'fred' placeholder in the
Page_Init method.

I want to remove all of the controls added to the 'fred' placeholder, within
my user control 'whatever:somet hing'.

My Whatever.ascx.c s Page_Init method looks like this:

// get the fred placeholder (this line works and returns a placeholder which
!= null)
System.Web.UI.W ebControls.Plac eHolder fred =
(PlaceHolder)Pa rent.Page.FindC ontrol("fred");

// clear all of freds controls
if (fred != null)
{
fred.Controls.C lear();
}

The fred.Controls.C lear() doesn't work, all of the controls that fred has
added (within Default.aspx.vb ) are still there :(

Is it something to do with the order in which the Page_Init methods are
called? Are they called in any specific order?

Any ideas? Please help!
Mar 5 '06 #1
0 1040

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

Similar topics

5
624
by: Torben | last post by:
For test purposes I attach an event to a control, say a TextBox TextChanged event. At another time the same event delegate is attached to some other control, maybe a listbox. Same event function every where. The event function should happen only once for that control (and then, maybe again if it is attached to the control again). Could I make that deattachment operation general? could the function find out what event it is attaced?...
0
1470
by: deepak | last post by:
i have set multiple selection property in bith listboxes(html control) to true. i have taken 2 buttons(html control) say Button1,Button2.now i want to add mutiple selected items to another listbox after clicking button1, and similray remvoing the mutiple selected ite,s from, another after clicking button2 ,, how can i do this ,, my script is given belo...
2
1901
by: ElGordo | last post by:
I was recently given .Net project files to work on. When I open the Solution file in VS.Net, I always get the message: "The solution appears to be under source control, but its binding information cannot be found. It is possible that the MSSCCPRJ.SCC file or another item that holds the source control settings for the solution, has been deleted. Because it is not possible to recover this missing information automatically, the projects...
9
20190
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new control. When I close the form I am expecting that the control ceases to be. However, if my object raises the event after the form has been closed, I find that there is still a user control object that handles it. Clearly the user control has not...
3
2627
by: Zorpiedoman | last post by:
Horay! I have just put the finishing touches on a new User Control... The" Jelly Button" I created a setup program which runs fine. I see the .dll nicely in the GAC. How come it does not show up in my Add/Remove componenets list when I try to add it to the toolbar?
3
14534
by: Christian Lutz | last post by:
Hy there I have a Web Services written in Java, running on Tomcat. The Client is written in C#. When i monitor the request/Response with TCPMon (included in Tomcat) i can observer the following sequence: ******************************************** CLIENT:: Request ********************************************
6
11138
by: AG | last post by:
I have a gridview with a template column containing an imagebutton to delete the row. Under some condition I don't want the row to be deleted, so would like to remove the button. In the RowDataBound event, I can find the button, but can't seem to remove it. The code below does not throw any exception, but the button is not removed. Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As
3
8588
by: Samnang | last post by:
Hi, How can I add or remove event of ASP.Net control at runtime, not in Page_Load? I want to click on a button for add or remove the event of another control. Thanks
1
5057
by: =?Utf-8?B?R3VkbmkgRy4gU2lndXJkc3Nvbg==?= | last post by:
Hi. I have written a .NET C# program and have also made a setup project for it. Everything works fine, except that I would like my setup application to remove any existing version of my program before proceeding with the setup. This is because I get the following message if there is a previous version of my program installed: 'Another version of this product is already installed. Installation of this version cannot continue. To...
3
5278
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
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
10501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10250
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
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7574
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
6811
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();...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.