i have a dynamically created user control which contains a non-dynamically
created ASP.Net button. When the button is clicked, the event is not fired.
I know that the control must be created on postback, and it is. However,
I've noticed an intriguing thing which I think might be at the root of the
problem.
My page inherits from a basepage, which in turn inherits from
System.Web.UI.P age. On initial load, the events fire something like this:
page.load (aspx page)
control.load (dynamically loaded ascx control)
base.CreateChil dControls (base page)
base.Render (base page)
however, on postback, the sequence of events changes to:
base.CreateChil dControls
page.load
control.load
base.Render
I imagine that this unexpected change of sequence, in addition to what I'm
probably doing in CreateChildCont rols is the cause of my problem. I'm
guessing this because if I make my page inherit directly from
System.Web.UI.P age, the problem is solved (also, if I don't make the control
dynamic, the problem is solved).
Here's my CreateChildCont rols in the base page, as I suspect I might be
doing something wrong in it:
Protected Overrides Sub CreateChildCont rols()
Me.Controls.Add (_plcContent)
Dim mainForm As HtmlForm = CType(Page.Find Control("frmMai n"), HtmlForm)
If Not mainForm Is Nothing Then
Dim Header As Control =
CType(Page.Load Control("~/Presentation/Header.ascx"), Control)
Dim Footer As Control =
CType(Page.Load Control("~/Presentation/Footer.ascx"), Control)
mainForm.Contro ls.AddAt(0, Header)
mainForm.Contro ls.Add(Footer)
_plcContent.Con trols.Add(mainF orm)
End If
MyBase.CreateCh ildControls()
End Sub
_plcContent is a new PlaceHolder defined in the base page.
Karl 1 1807
Karl, I am trying to Open my Mind.
Should MyBase.CreateCh ildControls() be first in line??
just guessing.
"Karl Seguin" <karl @ openmymind.net> wrote in message
news:u1******** *****@TK2MSFTNG P09.phx.gbl... i have a dynamically created user control which contains a non-dynamically created ASP.Net button. When the button is clicked, the event is not
fired. I know that the control must be created on postback, and it is. However, I've noticed an intriguing thing which I think might be at the root of the problem.
My page inherits from a basepage, which in turn inherits from System.Web.UI.P age. On initial load, the events fire something like this:
page.load (aspx page) control.load (dynamically loaded ascx control) base.CreateChil dControls (base page) base.Render (base page)
however, on postback, the sequence of events changes to: base.CreateChil dControls page.load control.load base.Render
I imagine that this unexpected change of sequence, in addition to what I'm probably doing in CreateChildCont rols is the cause of my problem. I'm guessing this because if I make my page inherit directly from System.Web.UI.P age, the problem is solved (also, if I don't make the
control dynamic, the problem is solved).
Here's my CreateChildCont rols in the base page, as I suspect I might be doing something wrong in it:
Protected Overrides Sub CreateChildCont rols() Me.Controls.Add (_plcContent) Dim mainForm As HtmlForm = CType(Page.Find Control("frmMai n"),
HtmlForm) If Not mainForm Is Nothing Then Dim Header As Control = CType(Page.Load Control("~/Presentation/Header.ascx"), Control) Dim Footer As Control = CType(Page.Load Control("~/Presentation/Footer.ascx"), Control) mainForm.Contro ls.AddAt(0, Header) mainForm.Contro ls.Add(Footer) _plcContent.Con trols.Add(mainF orm) End If MyBase.CreateCh ildControls() End Sub
_plcContent is a new PlaceHolder defined in the base page.
Karl
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DesignerX |
last post by:
I have a user control that contains a custom control, both are loaded
dynamically.
The custom control has a simple required field validator and a text box to
validate.
When the submit button in the user control is pressed the textbox does not
seem to be validated.
How do I even begin to troubleshoot this?
|
by: Danny Bloodworth |
last post by:
I have a usercontrol (login.ascx) that is very simple. It accepts
input through two textboxes, and then the user clicks an Imagebutton
to submit.
I have a parent form that checks the page security (security level
needed) against current user security (stored in the context object)
and
if user security >= level needed to view page then
dynamically loads a content control and displays content
|
by: sleigh |
last post by:
Hello,
I'm building a web application that will build a dynamic form based
upon questions in a database. This form will have several different
sections that consist of a panel containing one to many questions.
To keep it simple, I'll describe the basics of what I'm trying to
design.
I've created a TextBox composite control that consists of a label for
|
by: Gopal Krish |
last post by:
I'm have coded a simple menu (using link buttons as menu items) in a
user control to be reused across many ASPX pages.
In the page_load method I dynamically create the link buttons as
follows
LinkButton myLB = new LinkButton();
.........
.........
|
by: Wardeaux |
last post by:
All,
looking for sample project on how to add/edit/delete controls from an aspx
page at runtime... any pointers is most appreciated!!
My controls are simple: Label, Textbox, and DropList... I only want a
handful of custom properties to be set for the control...
MMTIA
wardeaux
| |
by: nicholas |
last post by:
Hello,
Got a kind of e-commerce site.
There are products with product options, such as color, size, etc
All are defined a table:
tbl_products: the table with the products.
tbl_options: the table with the options (Columns are: optionID,
parentoptionID, optionname).
|
by: Jeffrey Todd |
last post by:
I have successfully created functionality that mostly models what I'm trying
to do - which is dynamically insert controls into a user control (ascx), and
insert validation controls, also dynamically, for some of the inserted
controls.
The controls (e.g., textBoxes) get created correctly and viewstate is
maintained across postbacks, etc - BUT there is an issue with the validation
controls.
The validation controls, themselves are...
|
by: paula |
last post by:
I've got a problem with asp.net i am trying to make a menu control. and have
searched the web for serveral controls but they don't work correctly.
I am pretty new to asp.net building. What am i looking for. i am looking for
code to make a dynamical menu with submenus The menu items are stored in a MS
SQL Table and when by loading the page the items will be created. i have made
a asp table. i want my menu on the left cell, in the middle...
|
by: Nick |
last post by:
I have two navigation user controls and based on a query string will load one
or the other.
On the page that will load the user control I cannot do the following
Dim uc As FlashNavigation (The name of the code behind class)
I also can't do CType(uc, FlashNavigation)
I get Type 'FlashNavigation' is not defined. How can I dynamically load a
user control then access it's properties and or methods?
|
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...
|
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: 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: 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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |