消除触发按钮单击事件在刷新页面期间触发 [英] eliminating of firing button click event is firing during refresh of the page

查看:83
本文介绍了消除触发按钮单击事件在刷新页面期间触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含按钮和gridview的表单。当我输入数据并单击按钮数据时会在gridview中显示。但是当我再次刷新页面时,按钮单击事件正在触发,并且同样重复的数据附加到gridview.how我必须在刷新页面时消除按钮点击事件的触发.plz为我提供解决方案







提前谢谢

I have a form contains a button and gridview.when i enter data and click on button data is displayed in gridview.but when i refresh the page again button click event is firing and again same duplicate data is attaching to gridview.how i have to eliminate firing of button click event during refresh of the page.plz provide me solution



Thanks in advance

推荐答案

在我看来,您有代码在Page_Load事件中填充gridview。因为,按钮单击并刷新页面,它们都会导致回发,因此页面加载会执行两次。如果我的上述猜测是正确的,那么移动代码以将gridview更新为按钮单击事件。发布代码后,我可以更新解决方案。这应该成功。希望这会有所帮助。



干杯,

Naman
Looks to me that you have the code to populate your gridview inside Page_Load event. Since, button click and refreshing the page, both of them causes postback, so your page load gets executed twice. If my above guess is correct, then move the code to update the gridview to button click event. I can update the solution once you post the code. That should work out. Hope this helps.

Cheers,
Naman


这篇关于消除触发按钮单击事件在刷新页面期间触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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