JQuery Selector for ASP.NET server side control

I can't remember how many times I googled over this small snippet. Better save it somewhere we all can access.


  • $('#<%=ServerSideControl.ClientID%>') will find an element with the id attribute as supplied by theClientID property in ASP.Net.


  • $("[id$=ServerSideControl]") will find an element with an id attribute that ends with lblName, for examplefoo-lblName.

Popular posts from this blog

Print a receipt using a Thermal Printer with C#.NET

Automatic redirect upon session timeout using ASP.NET MVC and Javascript

Complex Master-Detail Form using Knockout.js and ASP.NET MVC