You need to use ASP.Net AJAX UpdatePanel to avoid Page refresh.
<div>
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:RadioButton AutoPostBack="true" ID="rb1" Text="Radiobutton1" GroupName="rb"
runat="server" OnCheckedChanged="Radiobutton1_CheckedChanged"></asp:RadioButton></td>
<asp:RadioButton AutoPostBack="true" ID="rb2" Text="Radiobutton2" GroupName="rb"
runat="server" OnCheckedChanged="Radiobutton2_CheckedChanged"></asp:RadioButton>
<br />
<asp:TextBox ID="TxtId" runat="server" Visible="false" Width="60px"></asp:TextBox>
<br />
<asp:TextBox ID="TxtName" runat="server" Visible="false" Width="30px"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</div>
C#
protected void Radiobutton2_CheckedChanged(object sender, EventArgs e)
{
if (this.rb2.Checked)
{
this.TxtId.Visible = true;
}
}
protected void Radiobutton1_CheckedChanged(object sender, EventArgs e)
{
if (this.rb1.Checked)
{
this.TxtName.Visible = true;
}
}