473,840 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PlaceHolder and UserControls

I have a UserControl loaded into a PlaceHolder and I have a button
there which is suppose to load another UserControl into the same
PlaceHolder and hide the previous one. Why does the events of the
controls that are inside the second UserControl doesn't work the first
time I try to rise them?

Sep 28 '06 #1
2 1453
Are you adding the controls to the placeholder at runtime? If you are,
then the controls need to be re-added to the placeholder on each
subsequent postback. Otherwise postback data will not be available,
events will not be wired etc.. here is a link that describes the
lifecycle of asp.net, it helped me understand what you need to do:


hope that helps!


David wrote:
I have a UserControl loaded into a PlaceHolder and I have a button
there which is suppose to load another UserControl into the same
PlaceHolder and hide the previous one. Why does the events of the
controls that are inside the second UserControl doesn't work the first
time I try to rise them?
Sep 28 '06 #2
Yes, I'm adding those controls at runtime, and I re-add them on each
subsequent postback, and still, I doesn't work.
Please, can you send me a simple project where I can see how can I
solve this problem.
thank you very much.

Oct 2 '06 #3

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

Similar topics

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 viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls...
by: John | last post by:
Hi all, My web app uses 3 different placeholders on one page and dynamically load usercontrols into them. That's all fine but now I have two situations which puzzle me: 1. I have a sub-folder of html pages from my site and I need to show one of these pages at a time within a specific placeholder on my main page. How do I go about doing this?
by: Anders K. Jacobsen [DK] | last post by:
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on solution file with aprox 10 projects. 2 of these is webprojetcs wich need to shere some common userControls. Optimally i want a class libarary project wich contains the controls so i could import the DLL and use the controls. But that of course doesnt work.
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); }
by: Joe | last post by:
Hello All, I have a user control which is composed of a label and a dropdownlist. In my code I add the user control to a placeholder on the webform. Now I want to be able to retrieve the selected value from the drop downlist when a user clicks a button server control. Here is the code that populates the user control and placeholder: Dim UControl As AugmentedDropDownList =
by: Thomas Bandt | last post by:
Hi all. I am filling some stuff into a PlaceHolder Control in my WebForm, i.e. UserControls and WebControls. So far so good. Now I want to manipulate the HTML output of this control and its child controls. I want to parse the HTML code for hyperlinks by regular expressions to extract them and display them seperately in a print mode of a webpage (as you can see it on
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender, SelectEventArgs e); public event SelectHandler OnSelect; protected void Page_Load(object sender, EventArgs e)
by: Nathan Sokalski | last post by:
In several of my UserControls I add properties. If I access these properties in the CodeBehind of the pages that use the controls, I recieve an error when compiling. The reason for this is because the compiler tries to compile the pages that use the UserControls before compiling the UserControls, and therefore does not know that the property exists when compiling. The only way around this that I have found is to use the CType() function as...
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows CType(Me.FindControl("admin" & CStr(section("buttontext")).Replace(" ", "")), adminsection2).RefreshSection() Next End Sub
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: 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,...
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: 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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.