Referencing a LinkButton in javascript

  • Thread starter Thread starter DanG
  • Start date Start date
D

DanG

Hi

I used to have an ImageButton in my datagrid, and referenced the
control in the javascript with:
var fld = document.getElementById('datagrid__ctl2_btnEdit');
alert(fld); //returns "[object]" >> Good

I changed the ImageButton to a LinkButton, but the javascript doesn't
work anymore.
var fld = document.getElementById('datagrid__ctl2_btnEdit'); //Same as
above
alert(fld); //returns "javascript:
__doPostBack('datagrid$_ctl2$btnEdit','');" >> Bad

It's returning the javascript to execute, rather than the object
itself.

So how do I reference the LinkButton object???

TIA
Dan
 
You should not hard code .NET controls in JavaScript. You should assemble
the JavaScript in the code behind and reference the name of the control
there so you can switch controls without a lot of pain.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Back
Top