I need to understand how I can access asp objects with jquery, because I have a file that it registers in the loading page of the code behind my aspx, whose script needs to be checked, I read elsewhere that I I can do it with this <%=txtName.UniqueID %>, but it doesnβt work, I am going to put my code and someone can help me. thank
button that starts checking this method in the script file
<asp:Button ID="btnOk" CssClass="btnOk" runat="server" Text="Ok" />
js
$(".btnOk").click(validateData);
function validateData() {
$("form").validate({
rules:
{
'<%=txtName.UniqueID %>': "required"
}
});
}
my code where I registered scripts
ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "<script language=javascript src='js/SetIndicators.js'> </script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Validator", "<script language=javascript src='js/jquery.validate.js'> </script>");
UPDATE
this is text input i need to check
<asp:TextBox ID="txtLayerName" CssClass="txtLayerName" runat="server"> </asp:TextBox>
C '<%=txtName.UniqueID %>'and <%=txtName.UniqueID %>does not work well with'.txtLayerName'
UPDATE 2
this is the name of the asp render
<input name="ctl00$ContentPlaceHolder1$txtLayerName" type="text" id="ctl00_ContentPlaceHolder1_txtLayerName" class="txtLayerName required" />
Jorge source
share