User Controls In Asp.net Prefixing String To Child Controls Causing Problem To Refer Them In Javascript
I have user control in which there are text boxes no i am using the AJAX to populate the child controls dynamically however asp.net appending some string to child controls causing
Solution 1:
You will need to refer to those controls like this:
// typical way
var element1 = document.getElementById("<%= control.ClientID %>");
// jquery way
var element2 = $("#<%= control.ClientID %>");
Solution 2:
Look at using someControl.ClientId
, which will give you the ASP.NET generated id of the control. Using this Id you will be able to correctly target the element via javascript.
Solution 3:
Use jquery to select the item using something like $("[id$='CWRCompanyId']")
, this basically looks for id's that end with your expected ID.
Post a Comment for "User Controls In Asp.net Prefixing String To Child Controls Causing Problem To Refer Them In Javascript"