Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hOW to stop page refreshing in asp.net
Posted

normally in asp.net when you clicks on a button or post the page entire page get posted on the server and return back to the client browser.


To avoid this you can use AJAX

put the button or control inside the UPDATEPANEL Which make page post.
and put the part of the page in UPDATEPANEL which will get changed.

By Using this instead of Entire Page post only required part of the page will get changed.3


eg..

XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>


<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
<contenttemplate>
<asp:label id="Label1" runat="server" text="Label">
<asp:button id="Button1" runat="server" text="Upload" onclick="btnUpload_Click" />



Button1_click()
{
Label1.Text = DateTime.Now.ToString();
}
 
Share this answer
 
v2
Comments
amolpatil2243 28-Sep-12 2:39am    
right !!!
when u want to stop page refreshing ,could u explain ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900