javascipt vlidation用于Gridview中文本框的数字输入 [英] javascipt vlidation for numeric input of a textbox inside Gridview

查看:53
本文介绍了javascipt vlidation用于Gridview中文本框的数字输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ajaxTab面板,并且在每个面板中我都有gridview,里面有很少的文本框,用户必须输入Sr.No应该是Numeric,我尝试了onKeyPress event./上调用的Nemeric Validation uisng Javascript函数。



但事件本身并没有被解雇。如果有人尝试了同样的方法并找到了解决方案,请回答这个问题。

解决方案





如果你使用GridView,试试这个



1.在RowDataBound中找到TextBox对象

2.使用TextBox对象添加属性,如下面的代码



txtName.Attributes.Add(onclick,javascript:return test(););



 <   script    类型  =  text / javascript  >  

function test(){
alert(called);
返回false;
}

< / script >





这是测试代码,根据您的要求更改代码


I am using ajaxTab Panel, and in each panel i have gridview inside which there are few textboxes in which user has to input Sr. No which should be Numeric, I tried the Nemeric Validation uisng Javascript function called upon onKeyPress event./

But the Event itself is not getting fired. If any one has tried the same and found some solution please answer this question.

解决方案

Hi,

If you use GridView, try this

1. Find TextBox object inside RowDataBound
2. Add attributes with the TextBox object like below code

txtName.Attributes.Add("onclick","javascript:return test();");

<script type="text/javascript">

    function test() {
        alert("called");
        return false;
    }

</script>



This is the test code, change the code as per your requirement


这篇关于javascipt vlidation用于Gridview中文本框的数字输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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