where is my user control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I've added a MyUserControl called MyUserControl1 to my aspx page.
the user control fires an event MyEvent which I want the page to handle.

I want to be able to write (in the codebehind: MyPage.aspx.cs)

MyUserControl1.MyEvent += someDelegate

the problem is that I have no handle on the usercontrol. where do I find it?
VS2003 does not initialise it in the codebehind. Is there some magic here?

mvh
Andreas
 
the problem is that I have no handle on the usercontrol. where do I find it?
VS2003 does not initialise it in the codebehind. Is there some magic here?

Just to answer myself (and anyone who might wonder about the same thing)
there IS black magic happening here.

You declare the variable in the codebehind-file (same type and same
identifier) and in run-time it will automagically have been initialised by
the page.

ie. just use the variable for all its worth, in run-time it won't be null.

mvh
Andreas
 

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

Back
Top