How do I reference an ASP.NET control from Javascript?

J

jm

I have control on a form. And I used to could reference it before I
made it an ASP.NET, runat=server control. As soon as I changed it the
server renumbered it, as expected.

I ended up doing a view source, because I knew the ctl_xx naming the
server did and got:

order_id_grid__ctl0_last_order_id

so I simply copied and pasted this into the javascript, so it could
find it, but I know that isn't the "right" way to do it.

What do I do to do this "right?" Thank you.
 
M

Marina

If you are trying to access controls inside a grid, I think you would have
to know the naming convention to locate the appropriately named control. I
guess you could also rely on them being in a certain order and look at the
collection of children for each node and navigate your way down to the
appropriate one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top