How to change user controls in visual studion 2005 without page loading?

Nov 23 2009 5:48 AM

Hi fiends,
I am using Visual studio 2005.In my form controls like this.see the below code.Here i click the Radio button  Yes the follwing controls displayed and no the following controls will be displayed.
Here click Radio button (yes,no) ,the page will be postback and get the information.I want same result without page loading?
 
--------------------------------------------------------------------------------------------------------
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="VRPL._Default" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<title>Untitled Page</title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
&nbsp;
<asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" GroupName="A"
OnCheckedChanged="RadioButton1_CheckedChanged" Style="z-index: 100; left: 47px;
position: absolute; top: 32px"
Text="Yes" />
<asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" GroupName="A"
OnCheckedChanged="RadioButton2_CheckedChanged" Style="z-index: 101; left: 108px;
position: absolute; top: 33px"
Text="No" />
<br />
<br />
<br />
<br />
Name:
<br />
Address:
<asp:TextBox ID="txtname" runat="server" Height="18px" Style="z-index: 102; left: 96px;
position: absolute; top: 83px"
Width="85px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="z-index: 107;
left: 50px; position: absolute; top: 165px"
Text="Button" Width="71px" />
<asp:TextBox ID="txtAdd" runat="server" OnTextChanged="txtAdd_TextChanged"
Style="z-index: 104; left: 91px; position: absolute; top: 118px" Width="92px" Visible="False"></asp:TextBox>
<asp:DropDownList ID="cboname" runat="server" Style="z-index: 105;
left: 92px; position: absolute; top: 85px"
OnSelectedIndexChanged="cboname_SelectedIndexChanged" Width="99px" Visible="False">
</asp:DropDownList>
<asp:DropDownList ID="cboAdd" runat="server" Style="z-index: 106; left: 94px; position: absolute;
top: 118px"
Width="95px">
</asp:DropDownList>

</div>
</form>
</
body>
</
html>
--------------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
namespace
VRPL
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
txtname.Visible =
true;
cboAdd.Visible =
true;
cboname.Visible =
false;
txtAdd.Visible =
false;

}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
txtname.Visible =
false;
cboAdd.Visible =
false;
cboname.Visible =
true;
txtAdd.Visible =
true;

}

protected void Button1_Click(object sender, EventArgs e)
{
string Name = txtname.Text;
string cboadd = cboAdd.SelectedValue.Trim().ToString();
string cboname1 = cboname.SelectedValue.Trim().ToString();
string ADDRESS = txtAdd.Text.Trim().ToString();
}
}
}

Answers (1)