Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 26th, 2011, 02: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:

Code:
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) 
            {
                Response.Clear();

                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.BinaryWrite(myFile.FileData);
                    }
                    else
                    {
                        Response.Redirect(System.IO.Path.Combine(FileStorageManager.UploadsFolder, myFile.FileUrl));
                    }
                }
                else
                    Response.Redirect("~/Main/SubmittedQuestionnaire.aspx");
            }
            else
            {
                Response.Redirect("~/Main/SubmittedQuestionnaire.aspx");
            }
        }
    }
}
[b]Below is the code for calling Viewfile from another aspx page:[/B]

Code:
 


<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"
            OnRowDataBound="GridView1_RowDataBound">
            <Columns>
                  
                <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" />
            </Columns>
            <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" />
        </asp:GridView>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03: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



All times are GMT -4. The time now is 05:45 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.