Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created pdf file. i want to name the pdf file based on user input.
eg, if user types his first name as John, then the pdf file name should be John.pdf and it should be opened in new window.
My code:
pdf1 is the folder where all the pdf files to be stored.
Response.Write("<script type='text/javascript'>");
Response.Write("window.open('pdf1/AalimAdmission.pdf','_blank')");

Response.Write("</script>");
Posted

1 solution

suppose your text box id is "txt1" then use


Response.Write("");
Response.Write("window.open('pdf1/'+document.getElementById("txt1").Value+'.pdf','_blank')")
Response.Write("");
 
Share this answer
 
Comments
sukumari1 14-Mar-13 3:14am    
i have stored user input in a string called name.
i tried giving Response.Write("window.open('pdf1/'+document.getElementById(name).Value+'.pdf','_blank')")
it's not working.
[no name] 14-Mar-13 3:49am    
Try this
if name declared server side
Response.Write("window.open('pdf1/'+<%=name%>+'.pdf','_blank')")

if name declared client side
Response.Write("window.open('pdf1/'+name+'.pdf','_blank')")
sukumari1 16-Mar-13 5:57am    
i got it.by giving
Response.Write("window.open('pdf1/'"+name+"'.pdf','_blank')")
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900