Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9212125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:27:14+00:00 2026-06-18T01:27:14+00:00

I have a gridview having field: <asp:TemplateField HeaderText=View File> <ItemTemplate > <asp:HyperLink ID=LinkView runat=server

  • 0

I have a gridview having field:

<asp:TemplateField HeaderText="View File">
    <ItemTemplate >     
        <asp:HyperLink ID="LinkView" runat="server" Target="_blank"></asp:HyperLink>
    </ItemTemplate>
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>  

In code behind, (Gridview’s RowBound)

Dim lnk As HyperLink = DirectCast(e.Row.FindControl("LinkView"), HyperLink) 
lnk.Attributes.Add("onclick", "OpenPdf('" + "file://" + fileName + "')")

Ex. fileName: E:\MyFolder\F1\File_01_15_2013_000100.pdf
And javascript function:

function OpenPdf(path1) {
    window.open(path1);
}

But it’s not working.
In IE, I’m getting an error: Access denied and in Firefox: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:27:15+00:00Added an answer on June 18, 2026 at 1:27 am

    You are given the physical path of the file instead you have to give the virtual path of the file, like

    fileName = "http://yourdomain.com/files/a.pdf"
    

    You need to put the file in website directory structure for path accessible through your domain. Suppose your current page is at root and pdf file in files folder. If do not want to put the images in the virtual directory of your website then you can create a new virtual directory having your files.

    Make a virtual directory inside your website and give path of folder that is outside your website folder and has images. Now this folder will act as it is part of your website and you will not get error. How to create Virtual Directory, MSDN

    Suppose you have website folder d:\Yoursites\Testsite and you want to access files within d:\file\a.pdf, make a virtual directory in side TestWebsite pointing to d:\files and access files within it through virual directory.

    The URL for pdf would be something like

    http://yoursite.com/yourvirtualdirectoryname//a.pdf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following gridview <asp:GridView ID=GridView3 runat=server AllowPaging=True AllowSorting=True AutoGenerateColumns=False DataKeyNames=ID DataSourceID=CommentsDataSource> <Columns>
I have a gridview with the alternatingRowStyle property set. <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False DataSourceID=SqlDataSource2
I have defined the following in my gridview markup (simplified): <asp:GridView ID=grvReport runat=server DataSourceID=odsReport
i am having a asp.net and c#.net application and i have a page gridview.aspx
Here's a dropdown list I have... <asp:DropDownList ID=selectTimeFrame runat=server AutoPostBack=true DataTextField=Increment DataValueField=Increment DataSourceID=SqlTimeFrame </asp:DropDownList>
I have a asp gridview with button field column on that button click I
So, I'm trying to have a field in a gridview which is a link
I have a gridview that is generating columns automatically (having a List<> DataSource), now
I am having a windows application where I have a gridview on one of
I have a table in sq server db having more than 1 million rows.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.