下の例を試してみてください:背後
コード:
public partial class AjaxUpdatePanelExample : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
RadioButtonList1.DataSource = new List<string> { "option 1", "option 2", "option 3" };
RadioButtonList1.DataBind();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
lblSelectedOption.Text = String.Format("Selected option - {0}",RadioButtonList1.SelectedValue);
}
}
.ASPX:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
</asp:RadioButtonList>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
<asp:Label ID="lblSelectedOption" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
私たちに関連するマークアップを表示してください。 – ConnorsFan