"Ben Schumacher" <bs*********@navegate.com> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
I keep getting a script error (Expected end of statement) when I try to add
the following attribute to a <asp:Button server control. My vb.net looks
as follows ...
Dim sUrl As String = "../popup/newfolder.aspx"
Dim vArguments As String = "document.all('" & cmdNew.ClientID & "')"
Dim sfeatures As String = String.Empty
Dim s As String = "vbscript:vReturnValue = window.showModalDialog('" &
sUrl & "', " & vArguments & ", '" & sfeatures & "')"
cmdNew.Attributes.Add("OnClick", s)
Any suggestions?
It looks as though you are using the single quote ' for all of your string
delimiters. The problem you are running into is that your vArguments is
set up using the ' as its delimiter so you are declaring it like this:
vArguments as string = "doucment.all('somevalue')"
Notice that <somevalue> is enclosed with ' delimiters.
If I put that into the s as String Line it would be like this:
Dim s as String =
"vbscript
:vReturnValue=window.showModalDialog('sur l','document.all('somevalue')','sfeatures')
In debug you should see it cut off here:
vbscript
:vReturnValue=window.showModalDialog('surl ','document.all(' --
When it hits this ' it thinks the string is done. To Fix this problem
enclose the vArguemtns with " double quotes. Like this:
Dim vArguments as String = "document.all(""" & cmdNew.ClientID & """)"
Good luck
jjardine