ASP.NET 2.0 - Enter Key - Default Submit Button
作者:互联网
2009-07-01
网页开发中最烦人的事情之一就是为表单处理"Enter key" ,"Enter key"已经成为用户提交表单的偏好。虽然我们为用户提供了提交按钮,但是最简单也是最直接的方式仍然是:输入文字,然后回车完成提交
ASP.NET 2.0中为此提供了很好的解决方法。只需要将"defaultbutton"属性指定到想要引发事件的按钮控件的ID上就可以了。
在表单级别和面板级别(
下面的实例代码中有一个表单和4个面板,报单和面板中都有按钮。情各位注意:在文本框中回车后会触发哪些按钮的事件
The corresponding, sample events for the button clicks are
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(Button1.Text);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Write(Button2.Text);
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Write(Button3.Text);
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Write(Button4.Text);
}
protected void btn1_Click(object sender, EventArgs e)
{
Response.Write(btn1.Text);
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Write(Button5.Text);
}
原文:
原文:
代码下载
实在不知道"Entry key"应该如何翻译,请各位指教。
谢谢
相关标签:
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
详解.NET Core如何构建一个弹性的HTTP请求机制
.NET Core使用Redis实现创建分布式锁
.NET内存管理释放的两种方式
基于.NET8实现WinFrom应用窗口自动缩放功能
浅析如何在 ASP.NET Core中实现速率限制
.NET Core 委托原理解析(最新推荐)
.NET 9 new features-Microsoft.ML.Tokenizers 库(文本标记化功能)
如何在 .NET 中使用 Tesseract 识别图片文字
ASP.NET Core Web API之Token验证的实现
asp.net core web api项目添加自定义中间件的实现
AI精选
