Eliyahu,
I have got this code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim strResponse As String
strResponse = strResponse & "<script language=""JavaScript"">" & vbCrLf
strResponse = strResponse & "var myObject = new Object(); " & vbCrLf
strResponse = strResponse & "myObject.guid = '" & strGuid & "'; " & vbCrLf
strResponse = strResponse & "myObject.id = 0; " & vbCrLf
strResponse = strResponse & "// The object myObject is sent to the modal
window. " & vbCrLf
strResponse = strResponse & "var answer =
window.showModalDialog('datagridHyperLink.aspx', myObject,
'dialogHeight:300px; dialogLeft:200px;'); " & vbCrLf
strResponse = strResponse & "document.getElementById('myHiddenInput').valu e=
myObject.id; " & vbCrLf
strResponse = strResponse & "window.alert(myObject.guid); " & vbCrLf
strResponse = strResponse & "window.alert(myObject.id); " & vbCrLf
strResponse = strResponse & "</script>" & vbCrLf
Response.Write(strResponse)
End Sub
I have got error again
document.getElementById(...) is null or not an object
Thanks again
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
You do it in javascript. Usually hidden text inputs are used to pass
values
from client to server.
document.getElementById("myHiddenInput").value=myP aram
Eliyahu
"Sergei" <se****@ssw.com.au> wrote in message
news:O9***************@TK2MSFTNGP15.phx.gbl... Yes, I pass an object as the second parameter.
But I don't know how to assign a value from the object in JavaScript to
the TextBox on the main form.
It gives error object is required
Thanks
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:O8****************@TK2MSFTNGP12.phx.gbl... > Just read your message second time.
>
> How do you pass values to the modal dialog? What I wrote was good if
> you
> are
> passing parameters in the second parameter of showModalDialog call.
> Otherwise, if you can access the values on server side, you can just
> use
> server code, like TextBox1.Value = myParam. What do you need javascript
> for
> then?
>
> Eliyahu
>
> "Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
> news:%2***************@TK2MSFTNGP15.phx.gbl...
>> What do you need VB for? Why can't you do everything on the client in
>> javascript in <body ... onload=...> event?
>>
>> Eliyahu
>>
>> "Sergei" <se****@ssw.com.au> wrote in message
>> news:Oe**************@TK2MSFTNGP14.phx.gbl...
>> > Hi,
>> >
>> > I am displaying modal dialog and passing values from the main form
>> > to
> the
>> > modal dialog and back.
>> > It works fine but if I used the following syntax on Page_Load(just for >> > testing) in VB to assign value form the object to text Box it gives
> error
>> > 'Object required'
>> > Dim strResponse As String
>> > strResponse = strResponse & "<script language=""JavaScript"">" & vbCrLf >> > strResponse = strResponse & "var aForm; " & vbCrLf
>> > 'Error is on the page- Object required
>> > strResponse = strResponse & "aForm =
>> window.document.body.all[""TextBox1""];
>> > " & vbCrLf
>> > strResponse = strResponse & "window.alert(aForm); " & vbCrLf
>> > strResponse = strResponse & "</script>" & vbCrLf
>> > Response.Write(strResponse)
>> >
>> > I want to assign a value from an object to TextBox in Java script
>> > but I >> > don't know how to refer to TextBox on page.
>> > Is it - window.document.forms('formname').elements('elemen tname')
>> > didn't
>> > work
>> >
>> > Thanks for your response.
>> >
>> >
>>
>>
>
>