[英]WebForms: How detect if I pushed ENTER Key or I clicked to a button to look for data
I have the typical Web Form with textbox, combobox and a buttonbox (which is the search button). 我有带有文本框,组合框和按钮框(即搜索按钮)的典型Web窗体。
After push in button I have to fill the data in a table. 按下按钮后,我必须将数据填写到表格中。
All of that controls are inside a FORM. 所有这些控件都在FORM内。
how can i detect if after push ENTER Key I want to simulate the search button? 按下ENTER键后,我如何检测是否要模拟搜索按钮?
Try this: 尝试这个:
TextBox tb = new TextBox();
tb.KeyDown += new KeyEventHandler(tb_KeyDown);
private void tb_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Enter)
{
//enter key is down
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.