Click here to Skip to main content
15,850,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

How to Avoid Page Refresh in

I have a login page with 3 textboxes and login button


UserName - Textbox1(TxtUserName)
DisplayName - Textbox2(TxtDisplayName)
Password - Textbox3(TxtPassword)

Login Button


when am entering UserName and pressing tab...,display name automatically displays....BUT PAGE IS REFRESHING.

how to avoid this, Please help me. THANX.
R. Giskard Reventlov 21-Jun-12 18:53pm    
Need to know the sequence of events and any code or markup that might be causing it. Sadly, my powers of telepathy have waned so I can't see inside your head and I'm not very good at guessing.
AspDotNetDev 21-Jun-12 18:54pm    
Maybe you have AutoPostBack set to true on the textbox? Edit your question to add some markup/code so we can see an a small example of exactly what you're talking about.
Raghuveer Kasyap 22-Jun-12 1:25am    
Hope that the AutoPostback Property of text box is set "true".
It should be set to false.

Basically, you are doing a server-request using a POST when you need to use jQuery to do a client-side call. Here is an explanation of how to do this:[^]

or here:[^]
Share this answer
AspDotNetDev 21-Jun-12 19:26pm    
It's not clear that the OP even wants anything to update, but if they are I'd probably recommend to them that they just use an UpdatePanel (unless they were using MVC).
Tim Corey 21-Jun-12 21:41pm    
Well, I assumed that was the case because the "display name automatically displays", which seemed to indicate an update was happening/needed. An UpdatePanel would work, although I haven't used one in a while, since jQuery is so easy to use and is so powerful. The jQuery ajax is so great.
Please use AJAX. If you use AJAX (ScriptManager, UpdatePanel, Contenttemplate) the Page cannot refresh.

Place your Controls here within ContentTemplate

<asp:ScriptManager ID="SavedScriptManager" runat="server">
<asp:UpdatePanel ID="savedUpdatePanel" runat="server">
Share this answer
If I am not wrong after entering Username in your txtUsername Textbox, you want to display the name of that User, for that you had put the AutoPostback=true. which is right. but In this scenario you want the username without refreshing the page.

For avoiding page refresh use updatepanel
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