在.net中输入按键问题 [英] Enter Key Press Problem in .net
本文介绍了在.net中输入按键问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在modalpopup中的确定按钮上按两次ENTER键时,我遇到了问题,我的数据保存了两次.因此,请帮助我避免两次按Enter键保存数据.我想要输入键事件来保存数据,所以我没有错误输入键事件.
谢谢您,
I am facing the problem when i press the ENTER KEY twice on ok button in modalpopup my data saved twice. So please help me to avoid two time data saving on ENTER KEY press. I want Enter Key Event for Saving data So I did not false the Enter Key Event.
Thank You,
推荐答案
当您的保存过程开始时,请禁用该按钮;当保存的数据比给出消息后要保存的消息多时,启用此按钮后,我认为您的问题会解决
看这个简单的例子
when your saving process start then disable the button and when data saved than give message that your data has saved than after enable true this button i think after that your problem will solve
look this simple example
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Enabled = false;
saveData();
Page.ClientScript.RegisterStartupScript(GetType(), "Script1", "alert('Data saved');", true);
Button1.Enabled = true;
}
这篇关于在.net中输入按键问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文