ASP.NET和C#,网络应用 [英] ASP.NET & C#, Web Applicatiom

查看:86
本文介绍了ASP.NET和C#,网络应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ASP页面的页面刷新时停止事件的重复发生.
当我们单击某个按钮时,它会执行单击事件,但是此后,当我们刷新页面时,它也会自动单击.如何解决?

浏览器不应存储我以前的点击事件.

How to stop the recurrence of event at page refresh in asp page.
when we click on some button it does its click event but after that when we refresh the page then it also clicked automatically. How can It may be solved ?

Browser should not store my previous click event.

推荐答案


如果您有访问数据层(数据库)的权限,则可以编写存储过程,该过程将检查记录是否存在,并相应地执行插入(或跳过)操作并以您喜欢的方式返回存在的内容. br/> 您可以像现在在代码中那样进行操作,但它可能不是标准编码".
不是"位于字符串内部,除了在C#端位于字符串内部外,什么都不做.它起着传递给数据库服务器的作用(将其解释为SQL语句)

或者,您也可以看到页面刷新会导致ASP.NET中的POST重复应用程序 [ ^ ]


希望对您有帮助!
--Amit
Hi,
If u have acess to the Data Layer (database), u can write a stored procedure, which does the checking, whether the record exists, and do the insert (or skip) accordingly and return, the existence in a way u prefer.
You may do that as you do it now in the code, but it may not be the "standard coding".
"is Not" is inside a string and is doing nothing other than being inside a string, in C# side. It comes into play one passed to Database server (interprets it as SQL statements)

Or you can also see Page Refresh Causes Duplicate POST in ASP.NET Applications[^]


Hope it helps!
--Amit


尝试加载页面负载!IsPostback(){//您在此处执行的任何代码}
Try to put on the Page load !IsPostback () { //whatever codes you''re doing in here }


这篇关于ASP.NET和C#,网络应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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