Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2010, 02:18 PM
Authorized User
 
Join Date: Jun 2003
Posts: 22
Thanks: 1
Thanked 0 Times in 0 Posts
Default Display pdf based upon GridView Dataset Record

Hi, I have a COM Pdf Viewer in my application that if I hard code a file location, will display the appropriate .Pdf.

My concern is how can I display the .Pdf based upon the current record in the gridView?

I am able to discern which record I am on within the gridView (therefore I have the ServerLocation and FileName) but am unable to put it all together to display the appropriate .Pdf.

The file path (file resides on another server) is stored in the DB as well as the filename (minus extension). Each directory (approx. 20) has multiple subdirectories (approx. 250) and the file can reside in either one of the directories.

The DB contains two fields: FileName, sLabel (server path).

I need to be able to loop through each subdirectory until it finds the FileName (txtFName) and if it is a ".Pdf" (there is a Tiff file in the same location), display the .Pdf file.

My code is as follows:
Code:
Dim p_sDir As String  'Physical file location ex. W:\imageLocation1
Dim txtFName As String 'FileName
 
p_sDir = "W:\" & grdDocs.CurrentRow.DataBoundItem("sLabel") 
txtFName = grdDocs.CurrentRow.DataBoundItem("FileName")
 
 

Dim p_CurDir As New IO.DirectoryInfo(p_sDir)
For Each p_Dir As IO.DirectoryInfo In p_CurDir.GetDirectories
If p_Dir.Extension.ToLower = ".Pdf" Then
AdobeReader.src = p_sDir & txtFName
End If
Next
This code loops but does return anything and I haven't been able to find the answer. Any help with this is tremendously appreciated!
__________________
SLBIBS

Last edited by slbibs; March 16th, 2010 at 03:00 PM..
 
Old April 7th, 2010, 02:38 PM
Authorized User
 
Join Date: Jun 2003
Posts: 22
Thanks: 1
Thanked 0 Times in 0 Posts
Default

For those that may be interested, I used a WebBrowser Control in my Form to view the .Pdf
__________________
SLBIBS





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
filling dropdownlist based on first in Gridview rakeshbindal4 ASP.NET 2.0 Basics 1 October 17th, 2007 06:55 AM
how to add new record as first record in dataset [email protected] ASP.NET 1.0 and 1.1 Professional 4 April 21st, 2006 05:23 AM
Exporting Web-Based Reports To PDF Ranoush Crystal Reports 2 September 4th, 2004 12:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.