Handling Events

Due to the code-behind logic, handling events in ASP.NET applications looks similar to what you saw about WPF. This means that you have a user control implemented on the XHTML side and an event handler in the Visual Basic side.

Handling Events Tip

If you need to catch events from objects that are not user controls, such as business objects or collections, you just write the event handler in Visual Basic code the usual way.

For example, consider the following XHTML code that provides a Button and a Label:

image

You can handle the Button.Click as usual, for example with the following code that writes a message to the Label:

Notice ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.