阻止页面刷新按钮单击asp.net 2.0 [英] prevent page refresh on button click asp.net 2.0

查看:120
本文介绍了阻止页面刷新按钮单击asp.net 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



每当我点击按钮页面刷新时,我在一个页面上有多个按钮。请帮我如何防止页面刷新按钮点击框架2.0中的asp.net



请帮助.............. 。

解决方案

1.默认情况下,ASP.NET中的按钮在<$ c $上设置 AutoPostback 属性c> true 并且每次点击都会将整个页面提交给网络服务器。



2.您应该更改 AutoPostback 属性为 false 并使用链接到按钮的JavaScript OnClick 事件和您可以使用JavaScript通过AJAX调用服务器上的操作(在您的代码后面)。



3.以下是一些例子:

在ASP.NET中使用jQuery for AJAX [ ^ ]

http://dotnetguts.blogspot.ro/2012/01/jquery-ajax-examples-by-calling-aspnet.html [ ^

Hello,

I have multiples button on one page whenever i click on button page refresh. please help me how can i prevent page refresh on button click asp.net in framework 2.0

please help...............

解决方案

1.By default the buttons in ASP.NET have AutoPostback property set on true and on each click the entire page is submitted to the web server.

2.You should change the AutoPostback property to false and to use JavaScript linked to the button OnClick event and you could use JavaScript to call actions on the server (on your code behind) by using AJAX.

3.Here are some examples:
Using jQuery for AJAX in ASP.NET[^]
http://dotnetguts.blogspot.ro/2012/01/jquery-ajax-examples-by-calling-aspnet.html[^]


这篇关于阻止页面刷新按钮单击asp.net 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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