Hi all,
How do I iterate through a specific placeholder and remove or hide all
controls contained within that placeholder?
Regards
John. 2 4032
Thanks Karl,
I'll give the loop through a try. The reason I don't want to set the
visibility to false is because I could have one of quite a few user controls
loaded into the placeholder and if I have say, 5 user controls loaded, the
load event will fire in each user control contained within the placeholder
which is unnecessary.
Incidentally, how does a user control differentiate between the first time
it has been loaded into a page and subsequent times?
Regards
John.
"Karl Seguin" <kseguin##crea. ca> wrote in message
news:OQ******** ******@TK2MSFTN GP10.phx.gbl... Why don't you just set the visibility of the placeholder to false?
YourPlaceHolder .Visible = false
If you need to loop through this child controls, try this:
Public Sub HideControls(By Val ParentCntrl As System.Web.UI.C ontrol) Dim ChildCntrl As System.Web.UI.C ontrol For each ChildCntrl in ParentCntr.Cont rols ChildCntrl.visi ble = false If ChildCntrl.HasC ontrols = True Then HideControls(Ch ildCntrl) End If Next End Sub
if you actually want to loop through the controls, "John" <a@b.com> wrote in message news:Ob******** ******@TK2MSFTN GP11.phx.gbl... Hi all,
How do I iterate through a specific placeholder and remove or hide all controls contained within that placeholder?
Regards John.
Set a viewstate for the control that tells whether is has been posted back
on.
in your user control:
void Page_Load(...)
{
if ( ViewState["IsUCPostba ck"] == null )
{
ViewState["IsUCPostba ck"] = true;
//data binding code
}
}
HTH,
bill
"John" <a@b.com> wrote in message
news:uT******** ******@TK2MSFTN GP11.phx.gbl... Thanks Karl,
I'll give the loop through a try. The reason I don't want to set the visibility to false is because I could have one of quite a few user
controls loaded into the placeholder and if I have say, 5 user controls loaded, the load event will fire in each user control contained within the placeholder which is unnecessary.
Incidentally, how does a user control differentiate between the first time it has been loaded into a page and subsequent times?
Regards John.
"Karl Seguin" <kseguin##crea. ca> wrote in message news:OQ******** ******@TK2MSFTN GP10.phx.gbl... Why don't you just set the visibility of the placeholder to false?
YourPlaceHolder .Visible = false
If you need to loop through this child controls, try this:
Public Sub HideControls(By Val ParentCntrl As System.Web.UI.C ontrol) Dim ChildCntrl As System.Web.UI.C ontrol For each ChildCntrl in ParentCntr.Cont rols ChildCntrl.visi ble = false If ChildCntrl.HasC ontrols = True Then HideControls(Ch ildCntrl) End If Next End Sub
if you actually want to loop through the controls, "John" <a@b.com> wrote in message news:Ob******** ******@TK2MSFTN GP11.phx.gbl... Hi all,
How do I iterate through a specific placeholder and remove or hide all controls contained within that placeholder?
Regards John.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jamie Fraser |
last post by:
Hi,
Is there a way to loop through EVERY control on a form (whether they
are directly on the form, or contained within children of the form)?
I would like to access the size and location of every control - at the
moment im just using a loop as:
For Each c As Control In Me.Controls
|
by: wASP |
last post by:
Hello again to all of you geniuses,
I'm having a problem trying to load dynamic controls at the initialization phase.
I've read the docs, and I thought I had it figured out:
<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>
<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>
.NET Framework Class Library
Control.Init Event
|
by: Tim T |
last post by:
Hi,
I have the need to use dynamically loaded user controls in a webform page.
I have the controls loading dynamically, and that part works fine. this is
the code used in a webform to dynamically load one of several controls:
private void btnCategory_Click(object sender, System.EventArgs e)
{
Control myControl = LoadControl(DropDownList1.SelectedItem.Text +
".ascx");
PlaceHolder1.Controls.Add(myControl);
|
by: Mike Speak |
last post by:
I have a user control that I want to use to render 4 menu items
(retrieved from db) on the top of each of my asp.net pages.
The user control defines a table, with one TR and one TD. Within the
TD I have a placeholder defined:
<asp:PlaceHolder ID="categoriesPlaceHolder" Runat="server" />
In the code behind of the user control, on the Page_Load event I am
retrieving data from db and adding controls to the placeholder as
|
by: Marius Trælnes |
last post by:
Hello!
I am about to make a class/control that creates tabbing functionality. The
result is in HTML/CSS/JavaScript output.
My question is: Within the tabs I want to simply add user controls and
without loosing viewstate etc etc. How can this be done? What is best
practice?
I guess the answer for my question lies in how I design/develop the tab
| |
by: Louise |
last post by:
I use Visual Basic .NET Framework 1.1, Visual Studio. I have a Web page
(aspx) referencing a control (ascx) that has a placeholder that is assigned
one of 2 child controls through buttons. The ViewState of the second child
control gets confused with the first child control - the first Text property
in the 2nd child gets updated with the first Text property of the 1st child
when the 2nd button is clicked after the 1st.
For instance,...
|
by: mark.norgate |
last post by:
I've run into a few problems trying to use generics for user controls
(classes derived from UserControl). I'm using the Web Application model
rather than the Web Site model.
The first problem I'm having is that the partial class signature in my
projectDetails.ascx.cs file looks like this:
public partial class ProjectDetailsControl<TEntryServiceProvider:
UserControl, INamingContainer where TEntryServiceProvider :
IEntryServiceProvider...
|
by: JimCinLA |
last post by:
I use a place holder to load different user controls on an .aspx page.
Let's call this default.aspx.
Each user controls contains about a dozen different ASP.Net controls.
My question is, how can I retrieve the list of controls from
default.aspx?
|
by: John |
last post by:
I am trying to get a control to insert into the HTML content for a page
which comes from our database. At the point I have a tag for the component I
want to add which is contained inside the HTML. I have tried to insert the
control into a placeholder with no joy. I want to have something similar to
DotNetNukes way of adding content to a page.
Does anyone have any ideas how to do this or where I'm going wrong?
What I have so far :...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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
| |
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...
| |