The ASP.NET RadioButtonList control allows you to create many radio buttons with one control. In this section, you build a survey form, work with the Collection editor, and hook up an event handler.
5.3.1. Creating the basic page interface
The survey interface consists of a prompt, a set of radio buttons as choices, a button, and an area for a response. Follow these steps to create the basic interface.
In the ASP.NET page Design view, add aLabelcontrol with the IDlblPromptand set theTextvalue toRate Your Fear of the Borg.
From the Toolbox, drop aRadioButtonListcontrol on the design surface and set its ID torblBorg.
Add anotherLabelwith the IDlblResponseand aButtoncontrol.
Bingo! And events
Think of a game of Bingo where players are filling their cards with markers. Suddenly, a hand shoots into the air and a player shouts, "Bingo!" That's an event.
Consider the player with the filled card as an ASP.NET control that raises an event called Bingo. The game's assistants are event handlers who intervene when someone claims to have a full card. The following pseudo-code (unusable code that represents a programming idea) shows how you might handle a Bingo event.
(ByVal player As Object, _
ByVal e As _
Dim blnIsValidBingo as _
Dim walker as New _
blnIsValidBingo = _
In ASP.NET, when someone clicks a button, the button doesn't ...
Get ASP.NET 3.5 For Dummies® now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.