Having trouble with response.write
I would like to show a pdf file when a user clicks on an image control. I am using the reponse.write comand. It used to work ( I thought) but does not now. I am using vb.net. Here is the sub.
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Response.Write("<script language=javascript>window.open('pdf files/Certificate and Scope.pdf');</script>")
End Sub
Can anyone tell me what is wrong? Thanks,
Jason
Re: Having trouble with response.write
Its because of the /> in the end of the script tag. You can either put this in a seperate response.write statement or i think its a better way if you add it in using this:
Code:
ImageButton1.Attributes.Add("onclick", "javascript:window.open('pdf files/Certificate and Scope.pdf');")
put it in your Load routine ;)
Re: Having trouble with response.write
Thank you, that worked great. is it possible to do this with the dropdownlist box when the user clicks on a list item. I would like to show the contents of a folder on the web page and then when a user selects a pdf file i would then like to diplay the file. I am new to asp.net and vb.net so I am still learning. Things are a little easier for me in VB6. I am able to get the contents of the folder into a dropdownlist box at this point. I am still having trouble with the Path to the folder where the pdf files are because fo the project name, don't know if it will work on the server or not. Does anyone have any ideas or examples to help.
Thanks,
Jason