Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
Suresh Suthar 8-Sep-11 7:32am    
What are you using for textbox1's client id in javascript? If it is textbox1.ClientID property than it should work properly. Can you post your code snippet?

1 solution

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.
 
Share this answer
 
Comments
tomuthupandi 8-Sep-11 9:03am    
Hi Sri,

Thanks for your response. This will help me to solve the problem.

But can you help me to know, Why the control id getting changed when we place the code in different systems?

- Muthu pandi
sriman.ch 9-Sep-11 8:07am    
go through once the following link
http://msdn.microsoft.com/en-us/gg454272
Hope it helps

Warm Regards,
Sri

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900