javascript - How to pass a text box value in html onclick event in asp.net -
i using asp.net web application. in application having 1 text box in web page inputs user. need read value in html source page have mentioned below.
<a href="" onclick="editdocumentwithprogid2('textbox1.text', '', 'sharepoint.opendocuments', '0', 'http://demo-1/blankpage', '0')">edit onclick</a>
in above line not able textbox1 value. need pass textbox value dynamically. how can ? need change in code? please me on this. thanks.
you can use scriptlet clientid if clientidmode
of textbox not static
. can use document.getelementbyid
dom object textbox control
onclick="editdocumentwithprogid2(document.getelementbyid('<%= textbox1.clientid %>').value, '0', 'http://demo-1/blankpage', '0')">edit onclick</a>
or can call function (parameterless) onclick , call editdocumentwithprogid2 function make call more readable.
html
<a href="" onclick="somefun();" > edit onclick</a>
javascript
function somefun() { editdocumentwithprogid2(document.getelementbyid('<%= textbox1.clientid %>').value,, '0', 'http://demo-1/blankpage', '0'); }
Comments
Post a Comment