473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 2468
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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,...
0
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...

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.