Why no events showing for usercontrol

L

Lloyd Sheen

I have a user control with two events. I drag it on the page I want to use
it. No problem. Execute to show the page and it renders correctly. So far
so good.

Now back to designer. Click on usercontrol and show properties. There are
none other than default usercontrol properties, again so far so good. There
is no events button on the properties window???

Now I double-click the usercontrol and am taken to code with the load event
of the usercontrol. While not what I wanted I am getting close. I pick the
usercontrol in the dropdown list of controls , and in the dropdown list of
events there are my events.


WHY IS THIS??? It seems that if you don't know how to manipulate VS 2005
Pro to get what you want it won't give it up very easily.


LLoyd Sheen
 
B

BlueJumper.com

You need to check that the event is public and you may need to add an
attribute to the event in the user control.

e.g. (C#)

[
Category("Action"),
Description("Event Description")
]

There is also attribute that defines if the event is available in the
designer, although I think it is by default. Another attribute that
you put on the usercontrol class defines what the default event is
(the one added when you double click the control).

Failing all that, override oninit() in the page code and manually add
the event.

e.g. uiMyControl.DoSomething += new EventHandler ........
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top