asp.net中的页面刷新问题 [英] page refresh problem in asp.net

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

问题描述

大家好,

我正在用C#开发一个应用程序(asp.net)...

i使用一个按钮在我的应用程序中插入数据,当我刷新我的网页数据将再次存储!!

有什么问题?!

hi all ,
i'm developing an application (asp.net) with C# ...
i use a button for inserting data in my app , when i refresh my web page the data will be stored again !!
what is the problem ?!

推荐答案

您正在搜索此内容。查看这个:

检测浏览器刷新到避免事件 [ ^ ]





使用此:



执行插入或更新语句后,将此代码放入

You are searching for this.Check this:
detect browser refresh to avoid events[^]

or
Use this:

After insert or update statement is executed place this code
Response.Redirect(Request.Url.AbsoluteUri);


Asp.net网页回发请求维护视图状态,因为它在页面被引用时触发最后一个事件

你可以在插入d之后发出新的请求ata使用response.redirect



希望这会有所帮助!!!
Asp.net webpage postback request maintain viewstate becuase of that it fires last event when page is refereshed
you can make a fresh request after inserting data using response.redirect

Hope this helps!!!


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

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