Tuesday, September 24, 2013

document.getElementById and asp.net with Master Pages

Using JavaScript to locate controls in ASP.net pages that are linked to master pages can be tricky.  This is because the ASP.net reassigned control IDs dynamically.

A simple solution is to use asp.net inline Tags.

For Example:

Instead for saying:

document.getElementById("Label1")

say

document.getElementById("<%=Label1.ClientID%>")


Thats it... I hope this helps some of you.

1 comment:

  1. Everything considered, a dedication of appreciation is all things special picsart diwali picture editing happy
    considered to post such a grand idea. I like this blog and I like the point and considering affecting it to right.

    ReplyDelete