The Invisible Datagrid (Help!)

lorena

Centurion
Joined
Oct 23, 2003
Messages
134
Location
Phoenix, Arizona
I am trying to read filenames from a folder on a virtual directory into a datagrid. It should be simple (I think) but while the page loads just fine, the datagrid is nowhere to be seen and I don't get any kind of error.
Just to make sure I could link to the folder, I created a "hard link" on a regular HTML page on the site and it works fine.

Here is my code:

<%@ Import Namespace="System.IO" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="chemacc.aspx.vb" Inherits="webforms.chemacc"%>
<HTML>
<HEAD>
<title>Chemical Acceptance</title>
<script runat="server">
Sub PageLoad
Dim sp as string
sp = Server.MapPath ("/p1/Quality/Acceptance_Recs/ChemAcc/")
dgCA.DataSource = Directory.GetFiles(sp, "*.pdf")
dgCA.DataBind
End Sub
</script>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<link href="http://intranet.talleyds.com/viper/styles/tocDOC.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<%
Response.WriteFile("includes/qHeader.asp")
%>
<table cellPadding="5" width="300" border="1">
<tr>
<th align="center">Chemical Acceptance Records</th></tr>
</table>
<asp:dataGrid id="dgCA" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 64px" runat="server" AllowPaging="True" AllowSorting="True" BorderStyle="Solid" BorderWidth="1px" ForeColor="DarkMagenta" />
</body>
</HTML>
I looked for a similar issue on the site but didn't find one.
Any and all advice or help would be MOST appreciated!:rolleyes:
 
I am having trouble with the debugger. I did set the directory to one on the server and reset the criteria to read any files in that directory but that didn't work either.
 
I'm confused by your code. The Page tag indicates that you are using a code behind file yet you have placed script code within the web form. Shouldn't all of the script code be in the associated code behind?
 
Success and then... Error Message

I made some changes to the code.
This code works:
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
' Dim dirInfo as New DirectoryInfo(Server.MapPath("/p1/Quality/Acceptance_Recs/ChemAcc"))
Dim dirInfo as New DirectoryInfo(Server.MapPath(""))
dgCA.DataSource = dirInfo.GetFiles("*.jpg")
dgCA.DataBind()
End Sub
</script>
<HTML>
<HEAD>
<title>Chemical Acceptance</title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<asp:DataGrid runat="server" id="dgCA" Font-Name="Verdana" AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White" HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" />
</Columns>
</asp:DataGrid>
</body>
</HTML>
HOWEVER, if I try doing a "MapPath" to the virtual directory which exists on a different server (the line above that is commented out "/p1/Quality...etc.)
I get this error:"The specified user does not exist"
The directory I am working in is in the root directory on the web server and the directory I am trying to list files from is set up as a virtual directory on the web server. Do I need to set up some kind of .Net user account between servers to access the directory?
 
Back
Top