您现在的位置是:网站首页> 编程资料编程资料
ASP.NET2.0使用Enter Key作为默认提交问题分析(附源码)_实用技巧_
2023-05-24
445人已围观
简介 ASP.NET2.0使用Enter Key作为默认提交问题分析(附源码)_实用技巧_
本文实例分析了ASP.NET2.0使用Enter Key作为默认提交的方法。分享给大家供大家参考,具体如下:
网页开发中最烦人的事情之一就是为表单处理"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); }
完整实例代码代码点击此处本站下载。
希望本文所述对大家asp.net程序设计有所帮助。
您可能感兴趣的文章:
相关内容
- asp.net实现利用反射,泛型,静态方法快速获取表单值到Model的方法_实用技巧_
- ASP.NET实现学生管理系统_实用技巧_
- asp.net实现输出xml的方法_实用技巧_
- .net等比缩放生成缩略图的方法_实用技巧_
- asp.net实现Gradview绑定数据库数据并导出Excel的方法_实用技巧_
- asp.net简单生成验证码的方法_实用技巧_
- asp.net基于windows服务实现定时发送邮件的方法_实用技巧_
- asp.net基于session实现购物车的方法_实用技巧_
- asp.net编程实现删除文件夹及文件夹下文件的方法_实用技巧_
- asp.net类序列化生成xml文件实例详解_实用技巧_
