Dynamic loaded webcontrol instantiation

K

kw

Page X loads WebControl Y which loads WebControl Z.

WebControlZ defines a button:
protected System.Web.UI.WebControls.LinkButton SearchByAssr;

here comes the problem:

private void InitializeComponent()

{

this.Load += new System.EventHandler(this.Page_Load);

this.ButtonZ.Click += new System.EventHandler(this.ButtonZ_Click);//CRASH!
ButtonZ is null



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

kw

Accck! Typo, I still have the problem, but I meant to say

protected System.Web.UI.WebControls.LinkButton ButtonZ;
 
E

Edward

How did you load WebControlZ? Check the relative ASCX file of WebControlZ,
is there ButtonZ ? the name should be the same as the codebehind defines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top