Click here to Skip to main content
11,718,289 members (84,387 online)
Click here to Skip to main content

Tagged as

ASP.NET MasterPage getElementById

, 26 May 2011 CPOL 16.5K 4
Rate this:
Please Sign up or sign in to vote.
To get an element by its ID in a webpage which uses a master page
We know that the id is changed when the page is rendered by when using a masterpage. The id is then prefixed with the master pages name appended with an underscore. For examle: If one writes a text box with an id of 'txtDate' it will be rendered as 00$contePlaceholder1$_txtDate. It is difficult to attach a javascript functionality to this element, but using query we can achieve this quite simply by writing:


Here jQuery gets an element / array of element of type input(textbox) the name of which ends with txtDate and attaches a date picker.



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


About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

GeneralJQuery Pin
Hariharan Arunachalam25-May-11 18:22
memberHariharan Arunachalam25-May-11 18:22 
GeneralNeeds some work Pin
Richard MacCutchan25-May-11 0:52
mvpRichard MacCutchan25-May-11 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150901.1 | Last Updated 26 May 2011
Article Copyright 2011 by nibeesh
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid