Link to home
Start Free TrialLog in
Avatar of mbart
mbart

asked on

how can I popup a pdf file?

I am at my wits end on what should be a simple solution.  I have a datagrid which has bound hyperlink column which is a pdf file name.  When the user clicks on it, I want to open a new window and show the pdf file.  Have searched every where and asked several different ways with no luck  I am using VB and need an example. Lots of points available, just need some help.
Avatar of Anandhi K
Anandhi K
Flag of United States of America image

in the aspx.cs file
dim url as string

in the itemdatabound event

dim hlnk as hyperlink  = (hyperlink) e.item.FindControl("hyperlinkid")

hlnk.attributes.add("Onclick","javascript:return fnopenwindow('"+ url +"')")


in the aspx file..
write a javascript

function fnopenwindow()
{
 var args = fnopenwindow.arguments
 window.open(args[0])
}
Avatar of deanvanrooyen
deanvanrooyen

Hi,

I use javascript - try the code in the handler for the link command in the datagrid
c#:

string js = "<script> window.open(\"numerical.pdf\")</script>";
Response.Write(js);

or you can get the value of the field and put it where I have "numerical.pdf"

hope this helps
cheers
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbart

ASKER

Thanks so much Henry that answers my questions on how to set it up.