Difference between client scripting usages

3 posts, 0 answers
  1. Abhilash
    Abhilash avatar
    12 posts
    Member since:
    Jul 2012

    Posted 15 Mar 2013 Link to this post

    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. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 19 Mar 2013 Link to this post

    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.
  3. Abhilash
    Abhilash avatar
    12 posts
    Member since:
    Jul 2012

    Posted 20 Mar 2013 Link to this post

    thank you
Back to Top