前台:
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div>
<asp:RadioButtonList runat="server" ID="RadioButtonList1"
OnSelectedIndexChanged="changed" AutoPostBack="True">
<asp:ListItem Value="0" Text="男"></asp:ListItem>
<asp:ListItem Value="1" Text="女"></asp:ListItem>
</asp:RadioButtonList>
<asp:Label runat="server" ID="Label1" Text="OK"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<input type="text" value="" name="OK" />
</form>
</body>
后台:
protected void RadioButtonListSelectedChanged(object sender, EventArgs e)
{
Label1.Text = (sender as RadioButtonList).SelectedItem.Text;
}
思路:
把RadioButtonList置入UpdatePanel 面板中。