Use updatepanel control, try the following example:
1. On the aspx page:
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="Server" EnablePartialRendering="true" />
<asp:UpdatePanel ID="updatePanel1" runat="server">
<ContentTemplate>
Light Switch
<asp:RadioButton ID="lightOn" AutoPostBack="true" runat="server"
GroupName="switch" Text="Turn On" OnCheckedChanged="lightOn_CheckedChanged" />
<asp:RadioButton ID="lightOff" AutoPostBack="true" runat="server"
GroupName="switch" Text="Turn Off" OnCheckedChanged="lightOff_CheckedChanged" />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
2. On the code behind:
protected void lightOn_CheckedChanged(object sender, EventArgs e)
{
Label1.Text = "Light has been turned on";
}
protected void lightOff_CheckedChanged(object sender, EventArgs e)
{
Label1.Text = "Light has been turned off";
}
Find out more
Introduction to the UpdatePanel Control[
^]