Jump to content
Xtreme .Net Talk

lorena

Avatar/Signature
  • Posts

    134
  • Joined

  • Last visited

Everything posted by lorena

  1. I have an aspx page that reads files from a folder and loads hyperlinks to those files into a datagrid. Since there are numerous files, I wanted to page the datagrid. The grid loads and has next and previous arrows at the bottom but only loads the first 40 files. Is there something else I need to do? Here is my code: <%@ Import Namespace="System.IO" %> <HTML> <HEAD> <title>Chemical Acceptance</title> <script language="VB" runat="server"> Sub Page_Load(sender as Object, e as EventArgs) Dim dirInfo as New DirectoryInfo(Server.MapPath("/plt/Qual/ChemAcc")) dgCA.DataSource = dirInfo.GetFiles("*.pdf") dgCA.DataBind() End Sub </script> </HEAD> <body MS_POSITIONING="GridLayout"> <asp:DataGrid runat="server" id="dgCA" Font-Name="Verdana" AlternatingItemStyle-BackColor="#eeeeee" PageSize="40" AutoGenerateColumns="False" AllowPaging="True"> <Columns> <asp:HyperLinkColumn DataNavigateUrlField="Name" DataNavigateUrlFormatString="http://intranet.yourcompanyhere.com/plt/Qual/ChemAcc/{0}" DataTextField="Name"></asp:HyperLinkColumn> </Columns> </asp:DataGrid> </body> </HTML>
  2. Cache fixed the problem! Works great now - thanks!
  3. I have a simple form that I have created. It accepts input and sends the results as e-mail. After the user clicks "Submit", they are redirected to a "Thank You" page. I want to be sure that if they click the "Back" arrow/button on their browser, they see a blank form. I have this code (which doesn't work) Sub Page_Load If Page.IsPostBack=True Then commentText.text = "" commentName.text = "" commentEmail.text = "" commentTel.text = "" commentType.SelectedItem.value = "Question" contact.checked = False End If End Sub What else can I do? Is there another way to have the page expire so it won't be submitted twice? Thanks
  4. I have a datagrid that binds (successfully) to a list of files in a virtual directory. I have set up the grid to hyperlink to the files so users can click on them and open the files - that part doesn't work. I tried setting the "NavigateURL" to the virtual directory but the hyperlink doesn't change. Here is my code: <title>Chemical Acceptance</title> <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")) dgCA.DataSource = dirInfo.GetFiles("*.pdf") dgCA.DataBind() End Sub </script> <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">Acceptance Records</th> </tr> </table> <p /> <asp:DataGrid runat="server" id="dgCA"> <HeaderStyle Font-Size="15pt" Font-Bold="True" ForeColor="White" BackColor="Navy" /> <Columns> <asp:HyperLinkColumn NavigateUrl="http://intranet.fred.com/v1/Acceptance/" DataTextField="Name" DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" /> </Columns> </asp:DataGrid></p> </body> The "NavigateURL" doesn't appear if I mouseover the link, instead it shows the current website and folder location. Any help would be appreciated. Thanks
  5. Thanks very much for the site but I checked there before I posted my question :(
  6. I have an aspx page that read and links to filenames in a virtual directory on a server other than the Intranet server where the .aspx page resides. I set up a hyperlink column in the datagrid but the link looks like this: "http://intranet.mycompany.com/webfolder/name" I need to change the link to read: "http://intranet.mycompany.com/xx/folder/filename.pdf" where xx is the virtual directory on the remote server and the filename changes with each link. I haven't used the datagrid enough to really know my way around. I would appreciate any help. Thanks
  7. 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?
  8. 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.
  9. 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:
×
×
  • Create New...