473,724 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PlaceHolder Disappears on Page PostBack

Hi all,

I have a placeholder control on an ASPX page. I
dynamically add a few button control and label control to the placeholder
from
code - all is well with the world. But on post back the
control disappears from the placeholder. Am I missing
something here
Please help

Vishal Gupta
Jun 1 '06 #1
2 3489
Hi,

You have to recreate them in the postback
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vishal Gupta" <vi**********@a cs-inc.com> wrote in message
news:eo******** *****@TK2MSFTNG P03.phx.gbl...
Hi all,

I have a placeholder control on an ASPX page. I
dynamically add a few button control and label control to the placeholder
from
code - all is well with the world. But on post back the
control disappears from the placeholder. Am I missing
something here
Please help

Vishal Gupta

Jun 1 '06 #2
i think i found a better solution.. We can do in Page_init Method...

ASP.NET pages automatically bind page events to methods that have the name
Page_event. This automatic binding is configured by the AutoEventWireup
attribute in the @ Page directive, which is set to true by default. If you
set AutoEventWireup to false, the page does not automatically search for
methods that use the Page_event naming convention.
http://msdn2.microsoft.com/en-us/library/6w2tb12s.aspx
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:u$******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

You have to recreate them in the postback
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Vishal Gupta" <vi**********@a cs-inc.com> wrote in message
news:eo******** *****@TK2MSFTNG P03.phx.gbl...
Hi all,

I have a placeholder control on an ASPX page. I
dynamically add a few button control and label control to the placeholder
from
code - all is well with the world. But on post back the
control disappears from the placeholder. Am I missing
something here
Please help

Vishal Gupta


Jun 1 '06 #3

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

Similar topics

0
1142
by: dwhitford | last post by:
I'm using a placeholder control to dynamically add textboxes to the web page. When the page loads I dynamically create a set of textboxes give them an id and a value. When the page postback I clear out the placeholder control recreate the textboxes give them new values and add them to the placeholder control. The problem is the original values still show on the page. I have also disabled the ViewState for everything. private void...
1
1412
by: Fraggle | last post by:
I have a placeholder in a repeater, along with a textbox. For each "repeat unit" I call the onitemdatabound method and decide what I am going to put in the placholder, checkboxlist or radiobuttonlist at the moment. This is displayed (as a questionare) the user then ticks, selects, and hits the "submit" button On postback, what is stored in the placeholders is lost, and if i want
1
5376
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 question is when the button is clicked and a postback is performed, the controls that were in the placeholder no longer appears on the screen! Am I doing something wrong here? Why are the controls back on the screen eventhough they have enable view...
1
1183
by: Ralph Krausse | last post by:
I have a sample at http://68.162.218.198/PlaceHolderTest/WebForm1.aspx. I am trying to figure out how capture a button event when I dynamically place a web user control in a placeholder control. I have 4 buttons that place a web user control in the placeholder, that all works find. YOu click on the button and you will see that it gets loaded. This web user control has a button in it but when I click on it, the event doesn't get captured...
9
2452
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx"); ucline.Initializecontrol(line,alternate); Placeholder1.Controls.Add(ucline); }
1
5695
by: Simon Wallis | last post by:
Hi, I have a PlaceHolder on a place, to which I add a DropDownList (using myPlaceHolder.Controls.Add(ddl). The user selects something from the DropDownList and posts the page. Now I try to get the value of what the user selected but the PlaceHolder's Controls collection is empty. I've tried turning viewstate of the PlaceHolder on and off but it doesn't make a difference (and I think I should be able to leave it off). What could be...
1
1593
by: Amir Ghezelbash | last post by:
Hey every body; first off let me say thanks every body..this place is great i have never came here with a problem and left without an answer..you guys are awsome any way i had a question rather a problem then a question i am using a placeholder control in my webform this control programmically loads up a custom control, the control that it loads up is a asp.net 2.0 wizard...now here is aproblem,
3
1990
by: Oren | last post by:
hi, How can I retrieve the Control (wucState.ascx) from the Placeholder at the even: btn_Click: //declaration at page protected wucState WucState1; -- my control .... private void Page_Load(object sender, System.EventArgs e) { .... WucState1 = Page.LoadControl("wucState.ascx") as wucState;
0
1979
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 returns 1 row of only 1 column. The GridView has only one field, a TemplateField. In GridView.RowCreated, I create a TextBox under a PlaceHolder statically
0
8868
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
8741
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
9388
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...
0
9241
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
9160
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
8062
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...
0
5996
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
4504
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...
3
2149
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.