在GridView中控制数据表 [英] control of datatable in a gridview

查看:73
本文介绍了在GridView中控制数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在动态创建一个具有10行的数据表,并将该表绑定到Gridview.

在Gridview中,我有4个dropdownlista,5个文本框和1个标签控件.

我想使用针对文本框的javascript进行客户端验证,但无法使用javascript找到gridview的文本框控件.

我已经搜索过google,但找不到解决方法.

请帮忙.

Hi,

I am creating a data table dynamically which has 10 rows and I am binding that table to Gridview.

In Gridview, I am having 4 dropdownlista, 5 textboxes and 1 label control.

I want to give clientside validations using javascript for textbox but I am unable to find the textbox control of a gridview using javascript.

I have searched google but I couldn''t get the solution.

Please help.

推荐答案

使用datagrid的Itemdatabound或gridview的RowDatabound事件访问行级别的控件.只需在数据绑定时将Javascript方法绑定到控件,即可自动触发验证事件.

因此,您需要的是将属性添加到文本框(或其他控件),在此onchange/onblur调用JS方法.也将控件的值作为参数传递.现在,您就具有了价值,进行所需的验证,并在需要时继续进行操作.
Use datagrid''s Itemdatabound or gridview''s RowDatabound event to access controls at row level. Just bind the Javascript methods to the control at the time of databind and the validation events would automatically get triggered.

So you need is, add attributes to the textbox(or other controls), at there onchange/onblur call a JS method. Pass on the value of the control as a parameter too. Now, you have the value, do the validation needed and move ahead if needed.


这篇关于在GridView中控制数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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