The AsyncRadioButton provides you with an Async-Enabled radio button server control.
<%@ Register Assembly="AsyncControls" Namespace="DelvingWare.AsyncControls" TagPrefix="dw" %> <dw:AsyncRadioButton runat="server" ID="rbMain1" Text="Blue" Group="one" OnCheckedChanged="rbMain_Checked" Value="blue" /> <dw:AsyncRadioButton runat="server" ID="rbMain2" Text="Green" Group="one" OnCheckedChanged="rbMain_Checked" Value="green" /> <dw:AsyncRadioButton runat="server" ID="rbMain3" Text="Yellow" Group="one" OnCheckedChanged="rbMain_Checked" Value="yellow" /> <p/> <dw:AsyncLabel runat="server" ID="lblMain" Width="450" RenderMode="div" CssClass="radioBtnLabel">Select a color.</dw:AsyncLabel>
using System; using DelvingWare.AsyncControls; ... protected void rbMain_Checked( object sender, AsyncEventArgs ae ) { // get the textual color value string color = (sender as AsyncRadioButton).Value; // change the color of the AsyncLabel lblMain.BackColor = System.Drawing.Color.FromName(color); // update the AsyncLabel text lblMain.Text = "AsyncLabel background color is now: "+ color; }
Imports System Imports DelvingWare.AsyncControls ... Protected Sub rbMain_Checked(ByVal sender As Object, ByVal ae As AsyncEventArgs) ' get the textual color value Dim color As String = CType(sender,AsyncRadioButton).Value ' change the color of the AsyncLabel lblMain.BackColor = System.Drawing.Color.FromName(color) ' update the AsyncLabel text lblMain.Text = ("AsyncLabel background color is now: " + color) End Sub
.radioBtnLabel { margin-top: 20px; border: 3px ridge silver; padding: 5px 0px 5px 10px; font-family: Verdana, Arial, Serif; font-size: 12pt; font-weight: bold; }