I’ve got an sql datareader that has a bunch of paths in it.
I need to open up multiple pop up windows / multiple tabs on the browser.
So I tried looping through my datareader and doing a ClientScript.RegisterStartupScript
but after the code completes nothing opens up…
Here is my code:
While r.Read()
ClientScript.RegisterStartupScript(Me.GetType, "popup" + counter.ToString(), "window.open('" + CType(r("AttachmentLink"), String) + "','_blank' + new Date().getTime(),'menubar=no')", True)
counter += 1
End While
I put a watch in and my reader does contain the data I want, but no popup window opens :(.
edit
Here is some sample data that is in the AttachmentLink column of my database:
\\myserver\myfolder\1.pdf
\\myserver\myfolder\mydoc.doc
\\myserver\myfolder\myimage.jpg
The actual link is to a local file server stored on our network…
Try changing the javascript to the following syntax:
If that doesn’t work, try creting the script first, like so:
One thing I noticed too is that you missed a semi-colon in the javascript code, sometimes it can mess things pretty bad.
Edited to Add
Answering a comment, you could use something like this: