Setting the text value of a Server Control from a JavaScript variable
Hello,
I have a webform which gets a text value from another form.
It gets it via the following....
Code:
<SCRIPT language="JavaScript" type="text/javascript">
function finish()
{
window.returnValue = 'Test It works';
window.close();
}
</SCRIPT>
When I received the text value. See below.......
Code:
<script language="VBScript" type="text/vbscript">
sub yeah()
dim ret
dim ofield
set ofield=Form1.elements("label3")
ret = window.showModalDialog("clookup.aspx?" & ssearch ,"Lookup","dialogHeight:200px;dialogWidth:300px;status:no;")
ofield.text=ret
'Here is where I try to assign the value of "Test it works"
'to my asp label control
end sub
ret will have the text value of "Test it works", because I used document.write to output it, but I can't seem to add the value of ret to an aps.net label.
lol, help, any ideas ?
Thanks :) :afrog:
Re: Setting the text value of a Server Control from a JavaScript variable
Disregard, as I figured it out.
Apparently Labels do not like getting values.
I tried the same thing with a textbox, and it worked just fine.
Code:
sub clook()
dim ret
dim ssearch
dim oform
dim ofield
set oform = document.forms("Form1")
set ofield = oform.elements("txtClientCode")
ret = null
ssearch = inputbox("Enter a client code or name:","Client Lookup")
if trim(ssearch) <> "" then
ret = window.showModalDialog("clookup.aspx?" & ssearch ,"Lookup","dialogHeight:200px;dialogWidth:300px;status:no;")
'document.write(ret)
if ret <> "" then
ofield.value = ret
end if
end if
end sub