Click here to Skip to main content
14,882,366 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to work Texbox textchange event code without use auto postback is true. If we declare auto postback is true then the page is refresh but i don't want to refresh the page.

Please help me....Thanks for advance
Posted
Comments
Ashishmau 6-May-11 5:51am
   
how many times u r asking same question.
Have u tried anything with answers given in your previous question which is same
Tarun.K.S 6-May-11 5:57am
   
If you don't like to do that, then put your TextBox in an UpdatePanel.

How to work Texbox textchange event code without use auto postback
You need to use one of the various ways to talk to server from client side. If you don't want your entire page to refresh on the postback and yet execute some method on textchange then look and implement one of the below that suits you:
1. XMLHttpRequest[^]
2. Callback[^]
3. WebService call[^]
4. PageMethod[^]
   
Comments
Wonde Tadesse 6-May-11 20:29pm
   
Good resources.
Sandeep Mewara 6-May-11 23:10pm
   
Thanks.
Hi Rahul,

If you are using server control then it might help you ;)

<asp:TextBox  onkeypress="javascript:alert('call a javascript function dear ');"   runat="server" ID="txtid"></asp:TextBox>

Let me know if this satisfy your purpose or not.
we will find some other solution 2gther ;)


Classic ajax can also help :)
:) Enjoy life
(Sachin Dabas)
   
v3
How to make scrambled eggs without breaking them?

Sorry, but you must live with the AutoPostback or without the event. Both come together or not at all. The choice is yours.
   
Comments
Wonde Tadesse 6-May-11 20:29pm
   
Agree.I gave my 5 :)
Keep your event intact, and learn about ajax.

If you are novice to ajax than use ajaxupdatepanel requires basic knowledge of asp.net toolkit.

And if you already know about ajax, try using JSON to make asynchronous postback.

Search google for ajaxupdatepanel you will get more information about it.

Hope this helps.. If you need any further help then reply...
   
XML
Thanks for the Q and here is the answer for it

<input type="text" onpropertychange ="MoniterChange()" id="Demo"/>
    <input type="text" id="Count" />


<script>
       function MoniterChange() {
           document.getElementById('Count').value = document.getElementById('Demo').value.length;
       }
   </script>
   
on Post back page load event is called always so to protect ur page from getting refreshed put that code in the ispostback event

if(!ispostback)
{

}
   
v2

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