gridview控件中的模板列 [英] Template column in gridview control

查看:295
本文介绍了gridview控件中的模板列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在gridview控件的模板列中有一个文本框.

在我的系统中,运行应用程序时,模板列中的文本框的控件ID为"Gridview1__ctl2_textbox1",并且基于此控件ID格式,我编写了一个Java脚本进行客户端验证.

当我在其他系统上部署文件时,控件ID格式将更改为"Gridview1_ctl02_textbox1",因此,我的JavaScript错误.

谁能帮我找到为什么控件ID格式更改的原因?

预先感谢,
-Muthu pandi

Hi,

I am having a textbox in template column in gridview control.

In my system, while running the application the textbox in template column is having the control id as "Gridview1__ctl2_textbox1" and based on this control id format i had written a java script for client side validation.

When i am deploying the files in some other system, control id format getting changed as follows "Gridview1_ctl02_textbox1" and because of this i am getting error in my javascript.

Can anyone help me to find, why the control id format is getting changed?

Thanks in advance,
-Muthu pandi

推荐答案

通过以下方式调用您的javascript函数
1.写一个javascript事件
< as:TextBox id ="txtTest" runat ="Server" onchange =返回测试(this);"/>
javascript:

函数Test(ctrl)
{
alert(ctrl.value);
}
2.编写一个javascript函数,并从gridview行数据绑定事件中显​​式调用它.

希望这对您有所帮助,如果您需要任何澄清.
Call your javascript function in the following ways
1.Write a javascript event
<as:TextBox id="txtTest" runat="Server" onchange="return Test(this);"/>
javascript:

function Test(ctrl)
{
alert(ctrl.value);
}
2. Write a javascript function and call it explicitly from gridview row data bound event.

Hope this helps , if u need any clarification post it.


这篇关于gridview控件中的模板列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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