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.