Select Server controls using JQuery

Selecting a server control using JQuery with the following syntax

$('#dropDownList1')

does not always gurantuee to return the control. The idea is that ASP.Net server controls create dynamic ids in case of duplicate control name or if the control is contained within a user control that is placed on page. Therefore, using the above statment will not always return the control except in the default case that the control is inserted directly to the page and there are no naming conflicts. So, In order to select the control using JQuery you will have to use the following statement:

$('#<=dropDownList1.ClientID>')

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: