Client script access to server side controls

D

Don Parker

Does the use of server side controls eg <asp:textbox> preclude the
access to that control by client script? If not, how do you reference
those elements?
 
J

Jason

Don,
You can access serverside controls via client script using the usual
methods, in most cases. For example, if your server side control name
is "txtProductName", then you can access the control in Javascript
using document.getElementById("txtProductName"). When using the
SmartNavigation feature, certain types of client script may not work
properly.
Jason
 
S

Saravana

If you place your textbox control inside any databound control like
repeater, datalist or datagrid. Then name and id of the textbox control will
be changed with respect to container element. Hence to access the textbox
control in client side, you need to use its clientid property(serverside
property) to get the id of the control to access it in client side.
 
D

Don Parker

Ah hah. I was trying to set the text property of the control. Since
that would not work and you guys are all telling me I should be able to
access this object - I tried using the normal value property that you
would use with ah HTML control and that works! Thanks!
 

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
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top