UserControl event

G

Guest

Hi All,

I have a UserControl and in the UserControl I have a few controls (textbox
buttons ect.) and I want to know how can I fire the "onchange" event (of the
usercontrol) when the textbox in the usercontrol is changing.

thanks and i hope you anderstood what am i asking..

Lin.
 
B

Brock Allen

You need to add your own even on the USerCotnrol that gets raised when the
contained control raises its event. So in the code on your USerControl add
something like:

public event EventHandler Change;

The in the DDL's ChangeEvent, raise your event:

if (Change != null) Change(this, EventArgs.Empty);

Then from the containing page you can handle the UserControl's Change event
just like you'd handle a Button's Click event.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

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

Top