如何在每个功能或事件上刷新页面 [英] how reduce refreshing a page on each and every functionality or event

查看:77
本文介绍了如何在每个功能或事件上刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的网页上有一个问题(使用Visual Studio 2010 4.0 Frame Work在Asp.Net和C#代码上开发)。

在一个页面中我有3个文本框

Textbox1是从日期

Textbox2是迄今为止

Textbox3是Variance(从从日期(文本框1)到到日期(文本框2)的工作天数)

我按照我在textbox2事件中编写的计算得到结果(当用户选择Todate时)然后它将计算并显示正确的结果)

所以这里的问题是它在计算时因为AutoPostBack =true整个页面刷新并显示结果并且页面正在页面顶部它没有停留或突出显示下一个控件,当我没有使用autopostback为真时我也使用了任何ajax控件然后结果没有计算并且也没有显示结果。



请帮我避免这个页面刷新和t页面问题的操作。



提前致谢

Venu

解决方案

将控件包装在asp:UpdatePanel中,以便通过ajax进行更新。


如果要在服务器上计算方差字段,可以使用更新包围这些文本框面板。更新面板允许您进行部分页面回发,因此只会更新其中的控件。



通过使用JavaScript计算客户端,您将获得更多性能

Hi All,

I have a question that in my web page(developed on Asp.Net and C# code using Visual Studio 2010 4.0 Frame Work).
In a page i have 3 textboxes
Textbox1 is From date
Textbox2 is To date
Textbox3 is Variance(Number of working days from "From date"(Textbox1) to "To date"(Textbox2))
And i am getting the result as per the calculation which i written in textbox2 event(when user selected Todate then it will calculate and displays the correct result)
So here the issue was when it was calculating because of AutoPostBack="true" whole page was refreshing and displaying the result and page was going top of the page it was not staying or highlighting to the next control and i dint used any ajax controls too when i am not using autopostback as true then the result was not getting calculated and not displaying the result as well.

Please help me to avoid this page refresh and top of the page issue.

Thanks in Advance
Venu

解决方案

Wrap your controls in an asp:UpdatePanel so that the update happens via ajax.


If you want the variance field to be calculated on the server, you could surround those text boxes with an update panel. Update panels let you do partial page post backs so only the controls inside it will be updated.

You'll get more performance however by doing you calculation client side with JavaScript.


这篇关于如何在每个功能或事件上刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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