Client script access to server side controls

  • Thread starter Thread starter Don Parker
  • Start date Start date
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?
 
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
 
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.
 
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!
 
Back
Top