如何在不触发OnTextChanged事件的情况下在ASP.NET TextBox中调用Java Script函数 [英] How to call Java Script function in ASP.NET TextBox without firing OnTextChanged Event

查看:70
本文介绍了如何在不触发OnTextChanged事件的情况下在ASP.NET TextBox中调用Java Script函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须触发asp控制文本框的JAVASCRIPT函数,以限制字符数,

我的问题是如何在不更改背后代码即.cs文件的情况下触发javascript函数,是否可以在不触发事件的情况下调用javascript函数..

I have to trigger the JAVASCRIPT function for asp Control Textbox,for Restricting the number of character,

My question is how to trigger the javascript function without changing the codebehind i.e., .cs file,is it possible to call the javascript function without the firing the events..

推荐答案

至 使用jQuery限制ASP.NET多行文本框中的字符数
请参阅

http://www.dotnetcurry.com/ShowArticle.aspx?ID=396 [ ^ ]


可能有帮助
To Limit Number Of Characters In an ASP.NET Multiline TextBox using jQuery
Refer

http://www.dotnetcurry.com/ShowArticle.aspx?ID=396[^]


may help


我认为您可以使用文本框的Maxlength属性.
为什么要使用JavaScript?
I think you can use Maxlength property of textbox.
Why you want go for javascript?


嗨...

您提供的解决方案链接工作正常,但是当我在VS 2003中尝试相同的方法时,则无法正常工作.甚至我已经在该javascript中添加了警报消息,但是当我按下键时却没有得到警报...实际上表明该事件甚至没有被触发.

您可以为此提供任何解决方案吗?
hi...

The solution link you have provided is working fine but when i try the same in VS 2003 its not working. Even i have added a alert message in that javascript but i didnt get the alert when i press the key... which actually tell that the event is not even fired.

can you provide the any solution for that.


这篇关于如何在不触发OnTextChanged事件的情况下在ASP.NET TextBox中调用Java Script函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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