I am using jQuery to try and trigger a method when a ASP.Net (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a row within that gridview.
I think I have it picking up the object using a ASP code block but the problem with that is that when the page first loads the edit index of the row does not exist and it throws an error. Putting the block inside a IF statement also does not work.
$(document).ready(function() //when DOM is ready, run containing code
{
<% if (grvTimeSheets.EditIndex > -1) {%>
$(#<%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %>).change(function() {
$(#<%= grvTimeSheets.ClientID %>).block({ message: null }
});
}
);
<% } %>
Is one attempt I made, I also tried putting the IF statement ASP code outside the JavaScript block. Doesn't work either.
Anyone with any ideas on how could I apply the jQuery event to the drop drop box? Ideally as concise as possible.
Thanks!