Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have ASP page in my .net Web application. There are lot of calculations on this asp page..
For example:
Textbox1
Textbox2
Textbox3...Textbox_n

And i want
Textbox2.text=textbox1.text/(2*100);
Textbox3.text=Textbox1.text+textbox2.text;
.....
like so many calculations to be done on textchanged event of many textboxes..

Every time when we change value in textbox the page is getting postbacked and due to multiple postbacks its taking so much time in loading...
How to avoid these multiple postbacks????????????
Posted

 
Share this answer
 
You should consider to do the Calculations using Client side scripts to avoid Postbacks.
 
Share this answer
 
Comments
Mayuri Gandhi 9-Mar-14 13:25pm    
How to do Client side scripts.. I dont have any Idea..
Plz give a example..
JoCodes 9-Mar-14 23:26pm    
Ok No problem. Try these links
http://stackoverflow.com/questions/15251780/calculating-total-from-textbox-live-using-javascript
http://www.dotnetgallery.com/lab/resource54-Get-textbox-value-using-jquery-in-aspnet.aspx
http://www.dotnetcodesg.com/Article/UploadFile/2/235/Sum%20of%20All%20Text%20Box%20Value%20on%20fly%20using%20jQuery%20in%20ASP.NET.aspx
Mayuri Gandhi 10-Mar-14 5:59am    
THANK YOU SO..... MUCH FOR YOUR SOLUTION....
BUT STILL MY PROBLEM PERSISTS...

THE SOLUTION IN FIRST LINK IS NOT WORKING AND IN THIRD LINK SOLUTION IS WORKING AND ITS TOO GOOD BUT IN THAT OPERATION IS DONE ON ALL TEXTBOXES WHEREAS I WANT TO DO OPREATION ON SPECIFIC TEXTBOXES AND ALL OPERATIONS ARE DIFFERENT....
PLZ HELP..
THANK YOU...
JoCodes 11-Mar-14 3:53am    
You can easily filter the needed textboxes using jqueryselector
Mayuri Gandhi 11-Mar-14 4:03am    
Ya..Done...
Thank you very much...
To stop postback of page, you need to implement the ajax call from the webpage page.


You need to call a javascript function from the client side, and that function we can write all the condition. If the values will come from the database then you need to write the static web methods in the code behind page and we need to do the ajax call. Using ajax call we can prevent the post back of web page.
 
Share this answer
 
Comments
Mayuri Gandhi 9-Mar-14 13:27pm    
Can you explain in detail with example??????
I dont have any idea how to do this...
Thanx..

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