Control ID Name

Control ID Name

am 16.01.2008 17:05:00 von OldButStillLearning

I want to write some javascript attached to some event. When the event
fires, I want to pass the name of a ASP.Net Control to the javascript. I
happen to be working in a web page which has a master page. What I notice is
that when the page is rendered the ID's of all of the ASP.Net controls are
altered with what appears to be a prefix. How can I know the ID name so that
my javascript can do a "document.getElementById(controlIDName)"?

RE: Control ID Name

am 16.01.2008 17:20:01 von brucebarker

var ctl = document.getElmentById('<%= myControl.ClientID %>');

-- bruce (sqlwork.com)


"OldButStillLearning" wrote:

> I want to write some javascript attached to some event. When the event
> fires, I want to pass the name of a ASP.Net Control to the javascript. I
> happen to be working in a web page which has a master page. What I notice is
> that when the page is rendered the ID's of all of the ASP.Net controls are
> altered with what appears to be a prefix. How can I know the ID name so that
> my javascript can do a "document.getElementById(controlIDName)"?

Re: Control ID Name

am 16.01.2008 17:25:47 von grava

"OldButStillLearning" wrote
in message news:1215B07C-3FCD-44B9-AEAF-A00B839724E7@microsoft.com...
> I want to write some javascript attached to some event. When the event
> fires, I want to pass the name of a ASP.Net Control to the javascript. I
> happen to be working in a web page which has a master page. What I notice
> is
> that when the page is rendered the ID's of all of the ASP.Net controls are
> altered with what appears to be a prefix. How can I know the ID name so
> that
> my javascript can do a "document.getElementById(controlIDName)"?

Well,

if you're writing javascript code directly in the aspx page you can use
something like this:

....


...




--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava