<%@ Page Language="C#" %>
<script language="C#" runat="server">
protected void Button1_Click( object sender, EventArgs e ) {
if ( RadioButtonList1.SelectedIndex > -1 )
Label1.Text = "You selected: " + RadioButtonList1.SelectedItem.Text;
}
protected void chkLayout_CheckedChanged( object sender, EventArgs e ) {
if ( chkLayout.Checked )
RadioButtonList1.RepeatLayout = RepeatLayout.Table;
else
RadioButtonList1.RepeatLayout = RepeatLayout.Flow;
}
protected void chkDirection_CheckedChanged( object sender, EventArgs e ) {
if ( chkDirection.Checked )
RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal;
else
RadioButtonList1.RepeatDirection = RepeatDirection.Vertical;
}
</script>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="RadioButtonList1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:RadioButtonList>
<asp:CheckBox id="chkLayout"
OnCheckedChanged="chkLayout_CheckedChanged" Text="Display Table Layout"
Checked=true AutoPostBack="true" runat="server" />
<asp:CheckBox id="chkDirection"
OnCheckedChanged="chkDirection_CheckedChanged"
Text="Display Horizontally" AutoPostBack="true" runat="server" />
<asp:Button id="Button1" Text="Submit" onclick="Button1_Click"
runat="server" />
<asp:Label id="Label1" Font-Names="Verdana" font-size="8pt"
runat="server" />
</form>
</body>
</html> |
|
|