如果你使用的是aspweb控件radiobuttonlist,那么当它们是回发时,你可以进行很多更改。您可以将该属性设置为SelectIndexChanged,这样每当它们发生更改时,都会导致回发,然后您可以从它们的(验证)中执行任何操作。
前任:
<asp:radioButtonList
id="radio1" runat="server"
autoPostBack="true"
cellSpacing="20"
repeatColumns="3"
repeatDirection="horizontal"
RepeatLayout="table"
textAlign="right"
OnSelectedIndexChanged="radio_SelectedIndexChanged">
<asp:ListItem text="10pt" value="itsMe"/>
<asp:ListItem text="14pt" value="itsYou"/>
<asp:ListItem text="16pt" value="Neither"/>
</asp:radioButtonList>
在服务器上,您应该有
protected void radio_SelectedIndexChanged(object sender, EventArgs e)
{
//do whatever you want by calling the name of the radio id
//example
if(radio1.SelectedItem.Value=="(whatever you want to test)"
}