C# 键盘Enter键取代Tab键实现代码
时间:2022-11-21 08:53:14
说明:在填写表数据时当输入完一个文本框后,输入下一个文本框时需要用Tab键切换,但是有的人喜欢用Enter键切换下一个,此方法是Enter取代Tab键。
效果:
注释:键盘Enter键数字为:13
键盘Tab键数字为:9
函数代码:
private void SetEnt()
{
foreach (Control txt in (this.Page.Form.FindControl("ContentPlaceHolderEntity")).Controls)
{
if (txt is System.Web.UI.WebControls.TextBox)
{
if (((TextBox)txt).CssClass != "erp_textarea")
((TextBox)txt).Attributes.Add("onkeydown", "if (window.event.keyCode==13) window.event.keyCode=9");
}
if (txt is System.Web.UI.WebControls.DropDownList)
{
((DropDownList)txt).Attributes.Add("onkeydown", "if (window.event.keyCode==13) window.event.keyCode=9");
}
if (txt is System.Web.UI.WebControls.CheckBox)
{
((CheckBox)txt).Attributes.Add("onkeydown", "if (window.event.keyCode==13) window.event.keyCode=9");
}
}
}
标签:C#,Enter,Tab
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
java基础之包装类的介绍及使用
2023-01-10 17:45:29
![](https://img.aspxhome.com/file/2023/5/61255_0s.png)
Flutter实现顶部导航栏功能
2023-03-10 17:13:48
![](https://img.aspxhome.com/file/2023/2/130442_0s.jpg)
Java利用POI读取、写入Excel的方法指南
2023-11-23 15:39:23
![](https://img.aspxhome.com/file/2023/9/59899_0s.png)
SpringBoot项目打成war和jar的区别说明
2023-10-05 04:54:15
![](https://img.aspxhome.com/file/2023/1/89501_0s.png)
Android中Socket大文件断点上传示例
2022-07-11 02:33:32
![](https://img.aspxhome.com/file/2023/9/117139_0s.jpg)
Springboot实现Shiro整合JWT的示例代码
2022-01-30 02:58:32
![](https://img.aspxhome.com/file/2023/1/65601_0s.png)
Spring定时任务使用及如何使用邮件监控服务器
2023-01-12 16:38:58
使用Java读取Word文件的简单例子分享
2022-12-17 02:15:19
![](https://img.aspxhome.com/file/2023/8/87358_0s.png)
简单工厂模式_动力节点Java学院整理
2022-07-22 16:42:08
![](https://img.aspxhome.com/file/2023/9/79159_0s.jpg)
JPA @Basic单表查询如何实现大字段懒加载
2021-06-03 18:02:00
![](https://img.aspxhome.com/file/2023/7/101977_0s.png)
Android SwipeRefreshLayout超详细讲解
2023-08-22 13:43:28
![](https://img.aspxhome.com/file/2023/7/94257_0s.gif)
java如何利用FastJSON、Gson、Jackson三种Json格式工具自定义时间序列化
2023-04-01 07:25:00
利用C#实现SSLSocket加密通讯的方法详解
2023-03-01 02:23:05
![](https://img.aspxhome.com/file/2023/4/102274_0s.png)
C# Dictionary的使用实例代码
2021-07-29 14:02:02
SpringBoot多环境开发与日志小结
2021-09-18 19:05:44
![](https://img.aspxhome.com/file/2023/9/78919_0s.png)
Android调用应用安装界面方法
2021-05-25 18:29:20
![](https://img.aspxhome.com/file/2023/4/94954_0s.jpg)
java8 stream多字段排序的实现
2021-07-30 17:47:47
探讨Android 的屏幕滚动操作不如 iPhone 流畅顺滑的原因
2023-04-05 09:05:33
Android 实现闪屏页和右上角的倒计时跳转实例代码
2022-12-10 17:32:32
![](https://img.aspxhome.com/file/2023/6/123356_0s.png)
mybatis-plus 如何使用雪花算法ID生成策略
2023-04-06 07:15:38
![](https://img.aspxhome.com/file/2023/7/106087_0s.jpg)