Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Handling

Status
Not open for further replies.

kenbw

Programmer
May 2, 2002
39
US
I'm trying to use event handling with a user control so that I can Raise an Event that the Webform the has the Control on it sees. The event raises fine within the web control, but I never see that event get fired on the Webform side. Does anyone have an idea as where I should start?

I have declared the Events on the Webform from the Control as Follows:

Protected WithEvents UCSearch1 As Newfx.SearchTool

Then I also have a sub that I thought would deal with the Event:

Private Sub UCSearch1_DDLUsersListChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UCSearch1.DDLUsersListChanged

'Business Logic

End Sub

Thanks in advance for any help.

Ken
 
Hey,

I have done something slightly similar where I made the controls in the user control public and then set the method I wanted to fire in the containing page. I would certainly like to find a better way to it (I am having to do too much work for the benefit of the control).

So basically in the user control I have image button controls which I set as public. Then in the containing page I put the event handler identification code in a pagePrep function. I don't have the syntax handy but it is the same as what is put into the InitializeComponent section generated by VS.

Please update this thread if you come up with a good solution as I would like to improve my solution to this problem.

Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Crystal,

I actually fgured out my solution on usings Events and it is very easy and clean to do once I figured out all the issues involved. The samples I used to finally figure it out were at O'reilly.com. Here is the link:


What my problem ended up being was that I had misnamed a WithEvent on the WebForm side so it did not catch the UserControl raised event. It really is very easy once you work through it.

I don't know the best way to explain it without a lot of code so if after you look at the link you still have questions please let me know I'll be happy to answer.

Ken

kenbw@yahoo.com
 
I am experiencing the same problem (not being able to see events from the UserControl on the web form), but unfortunately, the link provided here gives me only a server error.

Anyone figure this out?

Thanks,
Stacey
 
Found an answer, thanks to everyone here! If anyone else is looking for this, you can find the answer here:

thread855-554297, thanks to cbokowski!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top