我想在txtbox中按Enter进入另一个网络表单 [英] i want when in txtbox pressed enter go to another webform

查看:74
本文介绍了我想在txtbox中按Enter进入另一个网络表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的txtbox中输入我的Web表单重定向到另一个Web表单
想要有关此

i want in my txtbox pressed enter my webform redirect to another webform
a want a c# code about this

推荐答案

的C#代码,请使用以下代码:-
TextBox1 mytxt = new TextBox();
mytxt.Attributes.Add("onkeypress",返回ValidateKey(event)";

是的,重定向到其他Web表单.


函数ValidateKey(e)
{

if(e.keycode == 13)//输入要输入的键码13
返回true;
其他
返回false;

}

我没有测试.因此,可能需要进行一些更改.
use something like this:-
TextBox1 mytxt=new TextBox();
mytxt.Attributes.Add("onkeypress","return ValidateKey(event)";

True, redirect to other web forms.


function ValidateKey(e)
{

if (e.keycode == 13)//keycode 13 for enter
return true;
else
return false;

}

I''m not tested it. so, it might be required some changes.


处理文本框的"TextChanged"事件,即可解决问题.
Handle the "TextChanged" event of the textbox, this will do the trick.


这篇关于我想在txtbox中按Enter进入另一个网络表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆