473,414 Members | 1,944 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,414 software developers and data experts.

Placeholder's controls disappear during postback

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 causing the PlaceHolder's controls to disappear? Shouldn't
they be carried with the form post?

Thanks.
Nov 19 '05 #1
1 5677
If you are setting them up in your Page_Load based on certain events, you may
simply not be setting them up when it is a postback. If so, refactor to avoid
having them reset with postback.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Simon Wallis" wrote:
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 causing the PlaceHolder's controls to disappear? Shouldn't
they be carried with the form post?

Thanks.

Nov 19 '05 #2

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

Similar topics

2
by: Hai Nguyen | last post by:
Hi all I'm trying ing to create usercontrols dynamically and add them into a placeholder. During a postback i got the following error " Failed to load viewstate. The control tree into which...
2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
0
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...
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: Mark | last post by:
I'm adding several controls (labels, etc.) to a placeholder programatically. I'd like the PlaceHolder to maintain these contents during postbacks without having to programmatically recreate their...
9
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");...
3
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...
8
by: mark.norgate | last post by:
I've asked this question before, but still haven't solved it, so am asking again. I am programmatically adding a user control to the page in response to a button click. The user control consists...
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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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
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
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...

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.