如何避免asp页面上的多个回发? [英] How to avoid multiple postbacks on asp page?

查看:55
本文介绍了如何避免asp页面上的多个回发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.net Web应用程序中有ASP页面。这个asp页面有很多计算..

例如:

Textbox1

Textbox2

Textbox3。 ..Textbox_n



我想要

Textbox2.text = textbox1.text /(2 * 100);

Textbox3.text = Textbox1.text + textbox2.text;

.....

就像在许多文本框的textchanged事件上进行的那么多计算一样。



每次当我们在文本框中更改值时,页面都会被回复,并且由于多次回发,它会花费很多时间加载...

如何避免这些多重回发?

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????????????

推荐答案

停止ASP.NET链接按钮的多个回发 [ ^ ]



使用AspQ处理多个回发 [ ^ ]



第二个链接可能会解决您的问题:)



-KR
Stopping the multiple postbacks of ASP.NET linkbutton[^]

Handle Multiple Postbacks with AspQ[^]

2nd link might solve your problem :)

-KR


您应该考虑使用客户端脚本进行计算以避免回发。
You should consider to do the Calculations using Client side scripts to avoid Postbacks.


To停止页面回发,你需要从网页页面实现ajax调用。





你需要调用一个javascript函数客户端,我们可以写出所有条件的功能。如果值将来自数据库,那么您需要在代码隐藏页面中编写静态Web方法,我们需要执行ajax调用。使用ajax调用我们可以阻止回发网页。
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.


这篇关于如何避免asp页面上的多个回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆