i need to understand how i can get the access to objects asp with jquery because i have a file that it's register in page load of the code behind of my aspx that have the script need to do a validation, i read in different's site that i can do it with this <%=txtName.UniqueID %> but doesn't work i going to put my code and anyone could help me. thanks
the button that trigger the validation this method in the script file
<asp:Button ID="btnOk" CssClass="btnOk" runat="server" Text="Ok" />
the js
$(".btnOk").click(validateData);
function validateData() {
$("form").validate({
rules:
{
'<%=txtName.UniqueID %>': "required"
}
});
}
my code behind where i registered the 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 the text input that i need to validate
<asp:TextBox ID="txtLayerName" CssClass="txtLayerName" runat="server"> </asp:TextBox>
With '<%=txtName.UniqueID %>' and <%=txtName.UniqueID %> doesn't work also with '.txtLayerName'
UPDATE 2
this is the render name by asp
<input name="ctl00$ContentPlaceHolder1$txtLayerName" type="text" id="ctl00_ContentPlaceHolder1_txtLayerName" class="txtLayerName required" />