This is a migrated thread and some comments may be shown as answers.

Difference between client scripting usages

2 Answers 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abhilash
Top achievements
Rank 1
Abhilash asked on 15 Mar 2013, 05:05 AM
Hello all,
While handling controls in client side, some times I have to use $find("<%= txtSearch.ClientID %>") and some times $find("txtSearch").
So what is the difference between $find("<%= txtSearch.ClientID %>") and  $find("txtSearch"). Also when I have to use $find("<%= txtSearch.ClientID %>") and   $find("txtSearch"). Expecting a good explanation.

Thank you
Abhilash

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Mar 2013, 09:04 PM
Hi,

The ID generated in the final HTML is not guaranteed to remain the same as the one in your aspx source. When the control is placed inside naming containers the ID will have prepended one or several parent ids to ensure its uniqueness. The ClientID value is generated by concatenating the ID values of each parent naming container with the ID value of the control, so it's always recommended to use that in your javascript.

For more information about the ClientID property you can read the article below:
http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Abhilash
Top achievements
Rank 1
answered on 20 Mar 2013, 02:16 PM
thank you
Tags
General Discussions
Asked by
Abhilash
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Abhilash
Top achievements
Rank 1
Share this question
or