Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 April 26th, 2011, 01:00 PM
Registered User
Join Date: Apr 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Posting code for amended ViewFile: Text File adding HTML of source file

Hi Imar:

Here is the code for Viewfile.aspx:

namespace WebCertifyNow.Main
    public partial class ViewFile : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            if (Request.QueryString.Get("Id") != null) 

                Guid id = new Guid(Request.QueryString.Get("Id"));
                if (id != Guid.Empty)
                    File myFile = FileStorageManager.GetFile(id);

                    Response.ContentType = myFile.ContentType;

                    if (myFile.ContainsFile)
                        Response.Redirect(System.IO.Path.Combine(FileStorageManager.UploadsFolder, myFile.FileUrl));
[B]Below is the code for calling Viewfile from another aspx page:[/B]


<asp:GridView ID="GridView1" runat="server" DataSourceID="AnswerDataSource" AutoGenerateColumns="False"
            Width="687px" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px"
            CellPadding="4" ForeColor="Black" RowHeaderColumn="CertificationName" CellSpacing="2"
                <asp:BoundField DataField="QuestionText" HeaderText="QuestionText" SortExpression="QuestionText" />
                <asp:BoundField DataField="DetailText" HeaderText="DetailText" SortExpression="DetailText" />
                <asp:CheckBoxField DataField="YesNoBoolValue" HeaderText="YesNoBoolValue" SortExpression="YesNoBoolValue" />
                <asp:BoundField DataField="DocumentName" HeaderText="AttachedDocument" SortExpression="DocumentName" />
                <asp:HyperLinkField DataTextField="DocumentName" HeaderText="DocumentName" SortExpression="DocumentName"
                    DataNavigateUrlFields="AttachedDocumentId" DataNavigateUrlFormatString="ViewFile.aspx?Id={0}"
                    NavigateUrl="~/Main" />
            <FooterStyle BackColor="#CCCCCC" />
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
            <RowStyle BackColor="White" />
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a Text file from a HTML File or web page rajesh.java Java Basics 1 January 20th, 2007 08:36 AM
changing Text source file names rjjhome SQL Server DTS 1 August 18th, 2004 02:27 PM
CSV or Text file As a Report Record Source rickf Access VBA 0 February 12th, 2004 10:16 AM
CSV or Text file As a Report Record Source rickf Access 1 February 10th, 2004 07:37 PM

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