473,513 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

placeholder

2 questions please.

1) if i make a placeholder invisible or remove it programmatically
does that mean its contents wont get loaded. e.g. lets say i had a
heavy datagrid within the placeholder which took a few seconds to
load. if i made the placeholder invisible does that mean the grid
would not get loaded at all so the page would load quicker?

2) can you remove a placeholder programmatically?

thanks.

Nov 18 '05 #1
3 2474
Hi,

The control won't render to the client (Browser) but binding on the
server side would take place. So there will be performance improvement.
You can improve your performance if you won't create and bind your
control at all. Consider the following code :

System.Collections.ArrayList oArr = new System.Collections.ArrayList();
for(int i = 0; i< 11 ; i++)
{
oArr.Add("string " + Convert.ToString(i) );
}

ListBox o = new ListBox();
o.Visible = true;
o.DataSource = oArr;
o.DataBind();
PlaceHolder2.Controls.Add(o);

I create dynamic listbox and add it to Placeholder. I can remove place
holder programmatically:

this.FindControl("Form1").Controls.Remove(PlaceHol der2);

causing the datalist won't be render to the client. But I can use the
same condition and instead of removing place holder simply not to create
DatatList.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Jos
Wee Bubba wrote:
2 questions please.

1) if i make a placeholder invisible or remove it programmatically
does that mean its contents wont get loaded. e.g. lets say i had a
heavy datagrid within the placeholder which took a few seconds to
load. if i made the placeholder invisible does that mean the grid
would not get loaded at all so the page would load quicker?
When you make it invisible:
the content gets loaded. The content will not be shown, but
its state will be added to viewstate.

When you remove it programmatically:
the content doesn't get loaded.
2) can you remove a placeholder programmatically?


Yes. In VB:
Page.Controls.Remove(Page.FindControl("IDofMyPlace Holder"))

--

Jos
Nov 18 '05 #3
thanks guys. in my case i think i need to remove this programmatically
then becauser there's no point loading my contents if im not going to
display them.

thanks for the advice.

Nov 18 '05 #4

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

Similar topics

4
2547
by: blue | last post by:
I have a drop-down list, a radio button list and a submit button. I'm adding these controls to a table and I'm adding the table to a Placeholder. I'm adding it to the Placeholder because I don't...
2
4716
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...
1
2943
by: Dan | last post by:
I have an asp.net page default.aspx with a user control and a placeholder control. <html> <body> <form id="myform" method="post" runat="server" /> <PageHeader:Header id="header1"...
2
3049
by: Chad Crowder | last post by:
Is it possible to create a placeholder inside a template column of a datagrid? My goal is to use a placeholder, and during runtime add user controls to the placeholder as the items in the datagrid...
0
1575
by: shark | last post by:
I have a placeholder in a control that is in turn, used as a control in a placeholder in a form. I am getting a viewstate error so I believe I have to clear my placeholder before I load the...
1
5356
by: Angel | last post by:
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My...
2
6736
by: Ben de Vette | last post by:
Hi, I like to load a UserControl onto a placeholder with some more control then just doing protected System.Web.UI.WebControls.PlaceHolder placeHolder; UserControl ascx =...
6
2084
by: David Colliver | last post by:
Hi, using vb.net 1.1 I am trying to add a control to a placeholder but am having problems with it. I do it practically the same way as i do in C# (I have more C# skill than VB.NET)and I...
7
9065
by: Brad Baker | last post by:
I am trying to programmatically set a placeholder control in csharp which is nested inside a repeater control between <ItemTemplateand </ItemTemplate> tags, however I am running into problems. I've...
0
1967
by: F | last post by:
Hi, The funniest part of the problem described here is that I am not new to ASP.NET, but honestly here I have no idea about what's going on. I have a GridView with a data source that just...
0
7260
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
7384
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,...
1
7099
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
7525
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...
0
5685
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,...
1
5086
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
4746
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
1594
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 ...
1
799
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.