如何在asp.net中刷新页面而不重新发送值 [英] how to refresh a page in asp.net without resending the values
本文介绍了如何在asp.net中刷新页面而不重新发送值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在开发一个页面,以将数据插入数据库.刷新时,它将再次将相同的数据发送到数据库中.如何防止重新发送信息
I''m currently developing a page to insert data into a database. While refreshing it will send the same data again into the database. how to prevent resending the information
推荐答案
frnd,
frnd,
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//InsertData();
}
}
问候,
Karthik.J
regards,
Karthik.J
请保持页面加载代码到(!IsPostBack)中.
Hi,
Please keep your page load code into the (!IsPostBack).
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// your code here
}
}
谢谢,
Viprat
Thanks,
Viprat
如果在Page_Load事件中将数据插入数据库中
最好使用!IsPostBack
或
您可以使用按钮点击事件
If you inserting data into database in Page_Load event
better to go with !IsPostBack
or
You can use of button click event
protected void btnInsert_Click(object sender, EventArgs e)
{
//Insert function();
}
这篇关于如何在asp.net中刷新页面而不重新发送值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文