Completely Free .NET word API

Forums » .NET » ASP.NET »

how to open pdf in gridview hyperlink

Posted Date: 08 Nov 2008      Posted By:: abhishek_singh156 Profile photo    Member Level: Silver  Member Rank: 0     Points: 1   Responses: 1

i hv some code below

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="z-index: 100;
left: 298px; position: absolute; top: 318px" Text="Button" />
<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 101; left: 624px; position: absolute;
top: 168px"></asp:TextBox>
<asp:GridView ID="GridView1" runat="server" Style="z-index: 103; left: 203px; position: absolute;
top: 116px">
<asp:HyperLinkField HeaderText ="select" Text ="select" NavigateUrl ="~/TPC scan project/fw9_7.pdf"/>
<asp:HyperLinkField HeaderText ="select1" Text="select1" NavigateUrl="~/TPC scan project/scan-300dp.pdf" />
<asp:HyperLinkField AccessibleHeaderText ="select3" Text ="abc" NavigateUrl ="~/TPC scan project/Sheet1$.xls" />


and desin part i hv one button,one text box and one gridview,coding r below

using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
OleDbConnection con = new OleDbConnection("Provider=MSDAORA.1;Password=singh;User ID=abhishek;Data Source=orcl;Persist Security Info=False");
protected void Page_Load(object sender, EventArgs e)


protected void Button1_Click(object sender, EventArgs e)
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter("select ename,sal,job,empno from emp where ename LIKE '" + TextBox1.Text + "%'", con);
GridView1.DataSource = ds;

data is display in gridview properly but when i click on 1st column hyperlink(select) it will open pdf ok,when i click 2nd row hyperlink its also open same pdf.i know that why coz i define there pdf path,
but i hv lots of pdf file, i want in each row select(hyperlink) will be there and different-different pdf will be open.

plz reply below


No responses found. Be the first to respond and make money from revenue sharing program.

Post Reply     

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.

  • Return to Discussion Forum
  • Start new thread

  • Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India