如何检查textchanged上动态文本框的值 [英] How check value from dynamic textbox on textchanged

查看:75
本文介绍了如何检查textchanged上动态文本框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想动态创建文本框和其他控件。

我现在拥有一个动态创建的文本框,并在此按钮下。如果此文本框字段为空(textbox.text ==),则必须禁用该按钮。如果用户正在文本框中写入内容,则必须启用它。

只有在失去焦点后才有效。所以现在你可以在文本框中写入,但是当你在文本框中时按钮仍然被禁用。我想如果你在文本框中写一个按钮被启用的例子,如果我删除了一个而没有离开文本框,那个按钮再次被禁用。



希望有人能提供帮助。我是asp.net中的新手。

Hello,

i want to create dynamically textboxes and other controls.
I have now the site with a dynamic created textbox and under this a button. If this textboxfield is empty (textbox.text == "") then the button has to been disabled. If the user is writing something in the textbox it has to be enabled.
It works but only after it lost the focus. So now you can write in the textbox, but the button is still disabled while you are in the textbox. I want if you write for example a in the textbox that the button is enabled, and if i delete a without leaving the textbox, that the button is disabled again.

Hope someone can help. I am new in asp.net.

推荐答案

当你添加文本框控件时,添加onclick的html属性。



when you are adding the textbox control, add html attribute of onclick.

txtbxHowMany.Attributes.Add("onclick", "ValidateButton(this.id);");





现在,只需编写一个带有此名称的JavaScript函数并编写禁用按钮代码,如果需要更多帮助,请告诉我>



Now, just write a JavaScript function with this name and write ou code of disabling button, let me know if more help needed>


这篇关于如何检查textchanged上动态文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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