473,804 Members | 3,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic loaded webcontrol instantiation

kw
Page X loads WebControl Y which loads WebControl Z.

WebControlZ defines a button:
protected System.Web.UI.W ebControls.Link Button SearchByAssr;

here comes the problem:

private void InitializeCompo nent()

{

this.Load += new System.EventHan dler(this.Page_ Load);

this.ButtonZ.Cl ick += new System.EventHan dler(this.Butto nZ_Click);//CRASH!
ButtonZ is null

I don't get it...why is ButtonZ null?

Nov 18 '05 #1
3 1275
kw
Accck! Typo, I still have the problem, but I meant to say

protected System.Web.UI.W ebControls.Link Button ButtonZ;
"kw" <el************ *****@hotmail.c om> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Page X loads WebControl Y which loads WebControl Z.

WebControlZ defines a button:
protected System.Web.UI.W ebControls.Link Button SearchByAssr;

here comes the problem:

private void InitializeCompo nent()

{

this.Load += new System.EventHan dler(this.Page_ Load);

this.ButtonZ.Cl ick += new System.EventHan dler(this.Butto nZ_Click);//CRASH!
ButtonZ is null

I don't get it...why is ButtonZ null?

Nov 18 '05 #2
Is the sample code you provided contained in WebcontrolZ, WebControlY,or
Page X?

Dale

"kw" <el************ *****@hotmail.c om> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Page X loads WebControl Y which loads WebControl Z.

WebControlZ defines a button:
protected System.Web.UI.W ebControls.Link Button SearchByAssr;

here comes the problem:

private void InitializeCompo nent()

{

this.Load += new System.EventHan dler(this.Page_ Load);

this.ButtonZ.Cl ick += new System.EventHan dler(this.Butto nZ_Click);//CRASH!
ButtonZ is null

I don't get it...why is ButtonZ null?

Nov 18 '05 #3
kw
WebControlZ
"Dale" <da************ @msndotcomNot.N et> wrote in message
news:e%******** ********@TK2MSF TNGP09.phx.gbl. ..
Is the sample code you provided contained in WebcontrolZ, WebControlY,or
Page X?

Dale

"kw" <el************ *****@hotmail.c om> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Page X loads WebControl Y which loads WebControl Z.

WebControlZ defines a button:
protected System.Web.UI.W ebControls.Link Button SearchByAssr;

here comes the problem:

private void InitializeCompo nent()

{

this.Load += new System.EventHan dler(this.Page_ Load);

this.ButtonZ.Cl ick += new System.EventHan dler(this.Butto nZ_Click);//CRASH! ButtonZ is null

I don't get it...why is ButtonZ null?


Nov 18 '05 #4

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

Similar topics

0
1167
by: Thomas W. Brown | last post by:
I have a C# library that dynamically creates a in-memory assembly and creates instances of the objects therein. From .NET applications, this works perfectly well. However, when I wrap this library in a COM wrapper, the instantiation of objects in this dynamic assembly fails. But if instead of dynamically compiling to an in-memory assembly I compile to disk and then use Assembly.LoadFrom(...) then things work again. It appears that...
2
1851
by: Harry | last post by:
Hello, I have a composite WebControl that I'm dynamically instantiating at runtime using Reflection. When I create a new instance of my control I immediately iterate through it's child control collection (it has about 4 child controls). The problem is none of these controls are loaded or accessible when I create the instance since, I believe, they are created by the server at a later point in time. How could I force my composite control...
2
12361
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page contains multiple panels within the form. The panels appear at different times - for our argument, let's say panel 1 appears first, users clicks a submit button and then panel 1 disappears and panel 2 appears, etc. When clicks on the submit button...
0
1536
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have a webcontrol which allows a admin user to select a usercontrol to include within a page when in "edit mode". When a user is editing the page they see a dropdown list of available controls and select one and save the page, kind of irrelevant to...
1
2205
by: Diffident | last post by:
Hello All, I am trying to add dynamic controls onto my page and here is how I am doing that. I have a page which has a button called as "AddMoreControls" and in this button's event handler I am creating controls dynamically and adding them to a panel on the page. For example, if the button is clicked once, the page is posted back and the controls are added properly. However, if I click the "AddMoreControls" for the second time the...
2
1218
by: Lloyd Sheen | last post by:
Ok I have created a small testbed site for testing and I am have a problem with the terms Usercontrol, Webcontrol, etc. What I need to do in the long run is have a page using AJAX and having dynamically loaded controls on the page. So what I did was first create a page with two buttons. First button will load a Label control into a placeholder. After execution and clicking the button the label shows in the page.
13
1864
by: jerryau | last post by:
Hi, I am trying to dynamically create object instances based on a string class name, and then I need to dynamically set values to these objects, but I have no idea how to do this in C#. Here is the example of what I need to do: ******Dog.cs****** namespace MySystem {
0
5295
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all the days in the week with dates and textboxes to fill in some data. row 1: question
1
2536
by: Andre | last post by:
Hi. There is a way, that I can create a dynamic ID in a WebControl. This doesn´t work, but, looks like what I want: <asp:Button ID="btnAdd<%="1"%>" runat="server" Text="Add Resposta" OnClick="btnAdd_Click" /> I´ve tried to set up the id at the finish of the aspx, but, when I get in the codebehind, the id is the original. Doesn´t change.
0
9704
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
10318
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
10302
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
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
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 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...
0
5503
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...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
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.