Solved

Use Button in Gridview to Download File

Posted on 2008-10-12
7
6,117 Views
Last Modified: 2013-12-17
Hi,
I have a gridview where each row displays a file name (which is currently the file path) and info about the file.  I have added a button and named it "Download".

What I trying to do is have the user click on the Download button and have the save as box open so that they can download the file to their machine.

I have found a ton of code snippets but I am an absolute beginner and I just can't figure out what I am supposed to do with them.  

If anyone can help, I would really appreciate it.  I need any examples in C# because I do not know VB.  I have included all of the code I thought important but if I left something out, please let me know.

Thank you,
AJ

Source Code:
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewClientFilesbyDateRange.aspx.cs" Inherits="FileTransfer2.ViewClientFilesbyDateRange" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ViewFiles</title>
</head>
<body style="padding-right: 10px; padding-left: 10px; padding-bottom: 10px; padding-top: 10px; background-color: #eff3fb">
    <form id="form1" runat="server">
    <div style="padding-right: 10px; padding-left: 10px; padding-bottom: 10px; padding-top: 10px; background-color: #eff3fb">
        <asp:label id="lblSearchHeader" runat="server" font-bold="True" font-names="Calibri"
            font-size="Medium" text="Search Records by Date Range"></asp:label><br />
        <asp:textbox id="txtStartDate" runat="server" font-names="Calibri" font-size="Small"
            forecolor="Black">
        </asp:textbox>&nbsp;
        <asp:textbox id="txtEndDate" runat="server" font-names="Calibri" font-size="Small"
            forecolor="Black">
        </asp:textbox>
        &nbsp;&nbsp;
        <asp:button id="btnSubmitDates" runat="server" font-bold="True" font-names="Calibri"
            onclick="btnSubmitDates_Click" text="Submit" /><br />
        <asp:label id="lblEnterDates" runat="server" font-bold="True" font-names="Calibri"
            font-size="Small" text="Enter Start and End Dates (mm/dd/yyyy):"></asp:label><br />
        <asp:regularexpressionvalidator id="valStartDate" runat="server" controltovalidate="txtStartDate"
            display="Dynamic" errormessage="Start Date Formatted Incorrectly (mm/dd/yyyy)"
            validationexpression="\d{2}/\d{2}/\d{4}" font-names="Calibri" font-size="Smaller">
        </asp:regularexpressionvalidator>
        <br />
        <asp:regularexpressionvalidator id="valEndDate" runat="server" controltovalidate="txtEndDate"
            errormessage="End Date Formatted Incorrectly (mm/dd/yyyy)" validationexpression="\d{2}/\d{2}/\d{4}" font-names="Calibri" font-size="Smaller">
        </asp:regularexpressionvalidator><br />
        <br />
        <asp:gridview id="GridView1" runat="server" allowpaging="True" allowsorting="True"
            autogeneratecolumns="False" cellpadding="4" datasourceid="ObjectDataSource1"
            forecolor="#333333" gridlines="None" height="241px" style="font-size: smaller;
            font-family: Calibri, Arial" width="713px">
            <footerstyle backcolor="#507CD1" font-bold="True" forecolor="White" />
            <rowstyle backcolor="#EFF3FB" horizontalalign="Center" />
            <columns>
<asp:BoundField DataField="File Name" HeaderText="File Name" SortExpression="File Name"></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>
<asp:BoundField DataField="ClientFile" HeaderText="ClientFile" SortExpression="ClientFile"></asp:BoundField>
<asp:BoundField DataField="Upload Date" HeaderText="Upload Date" SortExpression="Upload Date"></asp:BoundField>
<asp:CheckBoxField DataField="eSign" HeaderText="eSign" SortExpression="eSign"></asp:CheckBoxField>
<asp:ButtonField Text="Download" ButtonType="Button">
<ControlStyle Font-Names="Calibri" Font-Size="Small"></ControlStyle>
</asp:ButtonField>
</columns>
            <pagerstyle backcolor="#2461BF" forecolor="White" horizontalalign="Center" />
            <selectedrowstyle backcolor="#D1DDF1" font-bold="True" forecolor="#333333" />
            <headerstyle backcolor="#507CD1" font-bold="True" font-size="Medium" forecolor="White"
                horizontalalign="Center" />
            <editrowstyle backcolor="#2461BF" horizontalalign="Center" />
            <alternatingrowstyle backcolor="White" />
        </asp:gridview></div>
        <asp:objectdatasource id="ObjectDataSource1" runat="server" oldvaluesparameterformatstring="original_{0}"
            selectmethod="GetFilesbyClientDateRange" typename="FileTransfer2.DataSets.ClientFilesbyDateRangeTableAdapters.getFilesbyClientDateRangeTableAdapter">
            <selectparameters>
<asp:Parameter DefaultValue="" Name="startDate" Type="DateTime"></asp:Parameter>
<asp:Parameter DefaultValue="" Name="endDate" Type="DateTime"></asp:Parameter>
<asp:Parameter Name="UserName" Type="String"></asp:Parameter>
</selectparameters>
        </asp:objectdatasource><br />
        <asp:button id="btnUploadFile" runat="server" font-bold="True" font-names="Calibri"
            onclick="btnUploadFile_Click" text="Upload New File" /><br />
        <br />
        <br />
    </form>
</body>
</html>
 
 
Code Behind:
 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
namespace FileTransfer2
{
    public partial class ViewClientFilesbyDateRange : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ObjectDataSource1.SelectParameters["UserName"].DefaultValue = this.User.Identity.Name;
            ObjectDataSource1.SelectParameters["startDate"].ConvertEmptyStringToNull = true;
            ObjectDataSource1.SelectParameters["endDate"].ConvertEmptyStringToNull = true;
 
            if (!Page.IsPostBack)
            {
                ObjectDataSource1.SelectParameters["startDate"].DefaultValue = string.Empty;
                ObjectDataSource1.SelectParameters["endDate"].DefaultValue = string.Empty;
                GridView1.DataBind(); 
            }
 
        }
 
        protected void btnSubmitDates_Click(object sender, EventArgs e)
        {
            ObjectDataSource1.SelectParameters["startDate"].DefaultValue = this.txtStartDate.Text.Trim();
            ObjectDataSource1.SelectParameters["endDate"].DefaultValue = this.txtEndDate.Text.Trim();
            GridView1.DataBind();
        }
 
    }
}
 
Stored Proc:
 
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
 
namespace FileTransfer2
{
    public class ClientFileRepository
    {
        public void InsertNewFile(string fileName, string description)
        {
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["FileTransferConnectionString"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("InsertNewFile", conn)) //stored proc name
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FileName", fileName); 
                    cmd.Parameters.AddWithValue("@Description", description);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
            }
        }
    }
}
 
 
ClientFilesbyDateRange DataSet:
 
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.1433
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
#pragma warning disable 1591
 
namespace FileTransfer2.DataSets {
    
    
    /// <summary>
    ///Represents a strongly typed in-memory cache of data.
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
    [global::System.Serializable()]
    [global::System.ComponentModel.DesignerCategoryAttribute("code")]
    [global::System.ComponentModel.ToolboxItem(true)]
    [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
    [global::System.Xml.Serialization.XmlRootAttribute("ClientFilesbyDateRange")]
    [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
    public partial class ClientFilesbyDateRange : global::System.Data.DataSet {
        
        private getFilesbyClientDateRangeDataTable tablegetFilesbyClientDateRange;
        
        private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public ClientFilesbyDateRange() {
            this.BeginInit();
            this.InitClass();
            global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            base.Tables.CollectionChanged += schemaChangedHandler;
            base.Relations.CollectionChanged += schemaChangedHandler;
            this.EndInit();
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected ClientFilesbyDateRange(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : 
                base(info, context, false) {
            if ((this.IsBinarySerialized(info, context) == true)) {
                this.InitVars(false);
                global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
                this.Tables.CollectionChanged += schemaChangedHandler1;
                this.Relations.CollectionChanged += schemaChangedHandler1;
                return;
            }
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
            if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
                global::System.Data.DataSet ds = new global::System.Data.DataSet();
                ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
                if ((ds.Tables["getFilesbyClientDateRange"] != null)) {
                    base.Tables.Add(new getFilesbyClientDateRangeDataTable(ds.Tables["getFilesbyClientDateRange"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
            }
            this.GetSerializationData(info, context);
            global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            base.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.Browsable(false)]
        [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
        public getFilesbyClientDateRangeDataTable getFilesbyClientDateRange {
            get {
                return this.tablegetFilesbyClientDateRange;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.BrowsableAttribute(true)]
        [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
        public override global::System.Data.SchemaSerializationMode SchemaSerializationMode {
            get {
                return this._schemaSerializationMode;
            }
            set {
                this._schemaSerializationMode = value;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public new global::System.Data.DataTableCollection Tables {
            get {
                return base.Tables;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public new global::System.Data.DataRelationCollection Relations {
            get {
                return base.Relations;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override void InitializeDerivedDataSet() {
            this.BeginInit();
            this.InitClass();
            this.EndInit();
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public override global::System.Data.DataSet Clone() {
            ClientFilesbyDateRange cln = ((ClientFilesbyDateRange)(base.Clone()));
            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return cln;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) {
            if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
                this.Reset();
                global::System.Data.DataSet ds = new global::System.Data.DataSet();
                ds.ReadXml(reader);
                if ((ds.Tables["getFilesbyClientDateRange"] != null)) {
                    base.Tables.Add(new getFilesbyClientDateRangeDataTable(ds.Tables["getFilesbyClientDateRange"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.ReadXml(reader);
                this.InitVars();
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
            this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
            stream.Position = 0;
            return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null);
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        internal void InitVars() {
            this.InitVars(true);
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        internal void InitVars(bool initTable) {
            this.tablegetFilesbyClientDateRange = ((getFilesbyClientDateRangeDataTable)(base.Tables["getFilesbyClientDateRange"]));
            if ((initTable == true)) {
                if ((this.tablegetFilesbyClientDateRange != null)) {
                    this.tablegetFilesbyClientDateRange.InitVars();
                }
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitClass() {
            this.DataSetName = "ClientFilesbyDateRange";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/ClientFilesbyDateRange.xsd";
            this.EnforceConstraints = true;
            this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
            this.tablegetFilesbyClientDateRange = new getFilesbyClientDateRangeDataTable();
            base.Tables.Add(this.tablegetFilesbyClientDateRange);
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private bool ShouldSerializegetFilesbyClientDateRange() {
            return false;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
            ClientFilesbyDateRange ds = new ClientFilesbyDateRange();
            global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace)) {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length)) {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) 
                                        && (s1.ReadByte() == s2.ReadByte())); ) {
                                ;
                            }
                            if ((s1.Position == s1.Length)) {
                                return type;
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null)) {
                        s1.Close();
                    }
                    if ((s2 != null)) {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return type;
        }
        
        public delegate void getFilesbyClientDateRangeRowChangeEventHandler(object sender, getFilesbyClientDateRangeRowChangeEvent e);
        
        /// <summary>
        ///Represents the strongly named DataTable class.
        ///</summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        [global::System.Serializable()]
        [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
        public partial class getFilesbyClientDateRangeDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable {
            
            private global::System.Data.DataColumn columnFile_Name;
            
            private global::System.Data.DataColumn columnDescription;
            
            private global::System.Data.DataColumn columnClientFile;
            
            private global::System.Data.DataColumn columnUpload_Date;
            
            private global::System.Data.DataColumn columneSign;
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeDataTable() {
                this.TableName = "getFilesbyClientDateRange";
                this.BeginInit();
                this.InitClass();
                this.EndInit();
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            internal getFilesbyClientDateRangeDataTable(global::System.Data.DataTable table) {
                this.TableName = table.TableName;
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected getFilesbyClientDateRangeDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : 
                    base(info, context) {
                this.InitVars();
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataColumn File_NameColumn {
                get {
                    return this.columnFile_Name;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataColumn DescriptionColumn {
                get {
                    return this.columnDescription;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataColumn ClientFileColumn {
                get {
                    return this.columnClientFile;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataColumn Upload_DateColumn {
                get {
                    return this.columnUpload_Date;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataColumn eSignColumn {
                get {
                    return this.columneSign;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeRow this[int index] {
                get {
                    return ((getFilesbyClientDateRangeRow)(this.Rows[index]));
                }
            }
            
            public event getFilesbyClientDateRangeRowChangeEventHandler getFilesbyClientDateRangeRowChanging;
            
            public event getFilesbyClientDateRangeRowChangeEventHandler getFilesbyClientDateRangeRowChanged;
            
            public event getFilesbyClientDateRangeRowChangeEventHandler getFilesbyClientDateRangeRowDeleting;
            
            public event getFilesbyClientDateRangeRowChangeEventHandler getFilesbyClientDateRangeRowDeleted;
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void AddgetFilesbyClientDateRangeRow(getFilesbyClientDateRangeRow row) {
                this.Rows.Add(row);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeRow AddgetFilesbyClientDateRangeRow(string File_Name, string Description, string ClientFile, System.DateTime Upload_Date, bool eSign) {
                getFilesbyClientDateRangeRow rowgetFilesbyClientDateRangeRow = ((getFilesbyClientDateRangeRow)(this.NewRow()));
                object[] columnValuesArray = new object[] {
                        File_Name,
                        Description,
                        ClientFile,
                        Upload_Date,
                        eSign};
                rowgetFilesbyClientDateRangeRow.ItemArray = columnValuesArray;
                this.Rows.Add(rowgetFilesbyClientDateRangeRow);
                return rowgetFilesbyClientDateRangeRow;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public virtual global::System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public override global::System.Data.DataTable Clone() {
                getFilesbyClientDateRangeDataTable cln = ((getFilesbyClientDateRangeDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override global::System.Data.DataTable CreateInstance() {
                return new getFilesbyClientDateRangeDataTable();
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            internal void InitVars() {
                this.columnFile_Name = base.Columns["File Name"];
                this.columnDescription = base.Columns["Description"];
                this.columnClientFile = base.Columns["ClientFile"];
                this.columnUpload_Date = base.Columns["Upload Date"];
                this.columneSign = base.Columns["eSign"];
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            private void InitClass() {
                this.columnFile_Name = new global::System.Data.DataColumn("File Name", typeof(string), null, global::System.Data.MappingType.Element);
                base.Columns.Add(this.columnFile_Name);
                this.columnDescription = new global::System.Data.DataColumn("Description", typeof(string), null, global::System.Data.MappingType.Element);
                base.Columns.Add(this.columnDescription);
                this.columnClientFile = new global::System.Data.DataColumn("ClientFile", typeof(string), null, global::System.Data.MappingType.Element);
                base.Columns.Add(this.columnClientFile);
                this.columnUpload_Date = new global::System.Data.DataColumn("Upload Date", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
                base.Columns.Add(this.columnUpload_Date);
                this.columneSign = new global::System.Data.DataColumn("eSign", typeof(bool), null, global::System.Data.MappingType.Element);
                base.Columns.Add(this.columneSign);
                this.columnFile_Name.AllowDBNull = false;
                this.columnFile_Name.MaxLength = 1000; //changed from 75
                this.columnDescription.MaxLength = 255;
                this.columnClientFile.MaxLength = 2147483647;
                this.columnUpload_Date.AllowDBNull = false;
                this.columneSign.AllowDBNull = false;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeRow NewgetFilesbyClientDateRangeRow() {
                return ((getFilesbyClientDateRangeRow)(this.NewRow()));
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
                return new getFilesbyClientDateRangeRow(builder);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override global::System.Type GetRowType() {
                return typeof(getFilesbyClientDateRangeRow);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.getFilesbyClientDateRangeRowChanged != null)) {
                    this.getFilesbyClientDateRangeRowChanged(this, new getFilesbyClientDateRangeRowChangeEvent(((getFilesbyClientDateRangeRow)(e.Row)), e.Action));
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.getFilesbyClientDateRangeRowChanging != null)) {
                    this.getFilesbyClientDateRangeRowChanging(this, new getFilesbyClientDateRangeRowChangeEvent(((getFilesbyClientDateRangeRow)(e.Row)), e.Action));
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.getFilesbyClientDateRangeRowDeleted != null)) {
                    this.getFilesbyClientDateRangeRowDeleted(this, new getFilesbyClientDateRangeRowChangeEvent(((getFilesbyClientDateRangeRow)(e.Row)), e.Action));
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.getFilesbyClientDateRangeRowDeleting != null)) {
                    this.getFilesbyClientDateRangeRowDeleting(this, new getFilesbyClientDateRangeRowChangeEvent(((getFilesbyClientDateRangeRow)(e.Row)), e.Action));
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void RemovegetFilesbyClientDateRangeRow(getFilesbyClientDateRangeRow row) {
                this.Rows.Remove(row);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
                global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                ClientFilesbyDateRange ds = new ClientFilesbyDateRange();
                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs = new decimal(0);
                any1.MaxOccurs = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name = "tableTypeName";
                attribute2.FixedValue = "getFilesbyClientDateRangeDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace)) {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length)) {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) 
                                            && (s1.ReadByte() == s2.ReadByte())); ) {
                                    ;
                                }
                                if ((s1.Position == s1.Length)) {
                                    return type;
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null)) {
                            s1.Close();
                        }
                        if ((s2 != null)) {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return type;
            }
        }
        
        /// <summary>
        ///Represents strongly named DataRow class.
        ///</summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        public partial class getFilesbyClientDateRangeRow : global::System.Data.DataRow {
            
            private getFilesbyClientDateRangeDataTable tablegetFilesbyClientDateRange;
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            internal getFilesbyClientDateRangeRow(global::System.Data.DataRowBuilder rb) : 
                    base(rb) {
                this.tablegetFilesbyClientDateRange = ((getFilesbyClientDateRangeDataTable)(this.Table));
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public string File_Name {
                get {
                    return ((string)(this[this.tablegetFilesbyClientDateRange.File_NameColumn]));
                }
                set {
                    this[this.tablegetFilesbyClientDateRange.File_NameColumn] = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public string Description {
                get {
                    try {
                        return ((string)(this[this.tablegetFilesbyClientDateRange.DescriptionColumn]));
                    }
                    catch (global::System.InvalidCastException e) {
                        throw new global::System.Data.StrongTypingException("The value for column \'Description\' in table \'getFilesbyClientDateRange\' is DBNull" +
                                ".", e);
                    }
                }
                set {
                    this[this.tablegetFilesbyClientDateRange.DescriptionColumn] = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public string ClientFile {
                get {
                    try {
                        return ((string)(this[this.tablegetFilesbyClientDateRange.ClientFileColumn]));
                    }
                    catch (global::System.InvalidCastException e) {
                        throw new global::System.Data.StrongTypingException("The value for column \'ClientFile\' in table \'getFilesbyClientDateRange\' is DBNull." +
                                "", e);
                    }
                }
                set {
                    this[this.tablegetFilesbyClientDateRange.ClientFileColumn] = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public System.DateTime Upload_Date {
                get {
                    return ((global::System.DateTime)(this[this.tablegetFilesbyClientDateRange.Upload_DateColumn]));
                }
                set {
                    this[this.tablegetFilesbyClientDateRange.Upload_DateColumn] = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public bool eSign {
                get {
                    return ((bool)(this[this.tablegetFilesbyClientDateRange.eSignColumn]));
                }
                set {
                    this[this.tablegetFilesbyClientDateRange.eSignColumn] = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public bool IsDescriptionNull() {
                return this.IsNull(this.tablegetFilesbyClientDateRange.DescriptionColumn);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void SetDescriptionNull() {
                this[this.tablegetFilesbyClientDateRange.DescriptionColumn] = global::System.Convert.DBNull;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public bool IsClientFileNull() {
                return this.IsNull(this.tablegetFilesbyClientDateRange.ClientFileColumn);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void SetClientFileNull() {
                this[this.tablegetFilesbyClientDateRange.ClientFileColumn] = global::System.Convert.DBNull;
            }
        }
        
        /// <summary>
        ///Row event argument class
        ///</summary>
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        public class getFilesbyClientDateRangeRowChangeEvent : global::System.EventArgs {
            
            private getFilesbyClientDateRangeRow eventRow;
            
            private global::System.Data.DataRowAction eventAction;
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeRowChangeEvent(getFilesbyClientDateRangeRow row, global::System.Data.DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public getFilesbyClientDateRangeRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public global::System.Data.DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
namespace FileTransfer2.DataSets.ClientFilesbyDateRangeTableAdapters {
    
    
    /// <summary>
    ///Represents the connection and commands used to retrieve and save data.
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
    [global::System.ComponentModel.DesignerCategoryAttribute("code")]
    [global::System.ComponentModel.ToolboxItem(true)]
    [global::System.ComponentModel.DataObjectAttribute(true)]
    [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
    [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
    public partial class getFilesbyClientDateRangeTableAdapter : global::System.ComponentModel.Component {
        
        private global::System.Data.SqlClient.SqlDataAdapter _adapter;
        
        private global::System.Data.SqlClient.SqlConnection _connection;
        
        private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
        
        private bool _clearBeforeFill;
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public getFilesbyClientDateRangeTableAdapter() {
            this.ClearBeforeFill = true;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private global::System.Data.SqlClient.SqlDataAdapter Adapter {
            get {
                if ((this._adapter == null)) {
                    this.InitAdapter();
                }
                return this._adapter;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        internal global::System.Data.SqlClient.SqlConnection Connection {
            get {
                if ((this._connection == null)) {
                    this.InitConnection();
                }
                return this._connection;
            }
            set {
                this._connection = value;
                if ((this.Adapter.InsertCommand != null)) {
                    this.Adapter.InsertCommand.Connection = value;
                }
                if ((this.Adapter.DeleteCommand != null)) {
                    this.Adapter.DeleteCommand.Connection = value;
                }
                if ((this.Adapter.UpdateCommand != null)) {
                    this.Adapter.UpdateCommand.Connection = value;
                }
                for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
                    if ((this.CommandCollection[i] != null)) {
                        ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
                    }
                }
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
            get {
                if ((this._commandCollection == null)) {
                    this.InitCommandCollection();
                }
                return this._commandCollection;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public bool ClearBeforeFill {
            get {
                return this._clearBeforeFill;
            }
            set {
                this._clearBeforeFill = value;
            }
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitAdapter() {
            this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
            global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
            tableMapping.SourceTable = "Table";
            tableMapping.DataSetTable = "getFilesbyClientDateRange";
            tableMapping.ColumnMappings.Add("File Name", "File Name");
            tableMapping.ColumnMappings.Add("Description", "Description");
            tableMapping.ColumnMappings.Add("ClientFile", "ClientFile");
            tableMapping.ColumnMappings.Add("Upload Date", "Upload Date");
            tableMapping.ColumnMappings.Add("eSign", "eSign");
            this._adapter.TableMappings.Add(tableMapping);
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitConnection() {
            this._connection = new global::System.Data.SqlClient.SqlConnection();
            this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["FileTransferConnectionString"].ConnectionString;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitCommandCollection() {
            this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
            this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "dbo.getFilesbyClientDateRange";
            this._commandCollection[0].CommandType = global::System.Data.CommandType.StoredProcedure;
            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@startDate", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@endDate", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserName", global::System.Data.SqlDbType.NVarChar, 256, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
            this._commandCollection[1].Connection = this.Connection;
            this._commandCollection[1].CommandText = "dbo.updateClientFiles";
            this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@FileName", global::System.Data.SqlDbType.NVarChar, 1000, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Description", global::System.Data.SqlDbType.NVarChar, 255, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UploadDate", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
        public virtual int Fill(ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable dataTable, global::System.Nullable<global::System.DateTime> startDate, global::System.Nullable<global::System.DateTime> endDate, string UserName) {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if ((startDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[1].Value = ((System.DateTime)(startDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
            }
            if ((endDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[2].Value = ((System.DateTime)(endDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
            }
            if ((UserName == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value = ((string)(UserName));
            }
            if ((this.ClearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
        public virtual ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable GetFilesbyClientDateRange(global::System.Nullable<global::System.DateTime> startDate, global::System.Nullable<global::System.DateTime> endDate, string UserName) {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if ((startDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[1].Value = ((System.DateTime)(startDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
            }
            if ((endDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[2].Value = ((System.DateTime)(endDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
            }
            if ((UserName == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value = ((string)(UserName));
            }
            ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable dataTable = new ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
        public virtual int FillClientFiles(ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable dataTable, global::System.Nullable<int> ID, string FileName, string Description, global::System.Nullable<global::System.DateTime> UploadDate) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((ID.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[1].Value = ((int)(ID.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
            }
            if ((FileName == null)) {
                this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value = ((string)(FileName));
            }
            if ((Description == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value = ((string)(Description));
            }
            if ((UploadDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[4].Value = ((System.DateTime)(UploadDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[4].Value = global::System.DBNull.Value;
            }
            if ((this.ClearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
        [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
        public virtual ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable UpdateClientFiles(global::System.Nullable<int> ID, string FileName, string Description, global::System.Nullable<global::System.DateTime> UploadDate) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((ID.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[1].Value = ((int)(ID.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
            }
            if ((FileName == null)) {
                this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value = ((string)(FileName));
            }
            if ((Description == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value = ((string)(Description));
            }
            if ((UploadDate.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[4].Value = ((System.DateTime)(UploadDate.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[4].Value = global::System.DBNull.Value;
            }
            ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable dataTable = new ClientFilesbyDateRange.getFilesbyClientDateRangeDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
    }
}
 
#pragma warning restore 1591

Open in new window

0
Comment
Question by:AJ0424
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22700186
Hi AJ0424

If the files are exising on server you can use the following URL as help.
http://www.xefteri.com/articles/show.cfm?id=8

Thanks

Harry
0
 

Author Comment

by:AJ0424
ID: 22702047
Thanks Harry.

I have seen that example before but still have a couple of issues with it.  First of all, it is in VB and I am working in C# (I'm too new to be able to translate it).

What I have added to my code is: (example below: protected void GridView1_SelectedIndexChanged(object sender, EventArgs e))

Unfortunately, I still receive and error on the Response.AddHeader line:
The name 'strFileName' does not exist in the current context

AJ


        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
            Response.ContentType = "FileExtension";
            Response.TransmitFile("Path");
            HttpContext.Current.ApplicationInstance.CompleteRequest(); 
        }

Open in new window

0
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22706350
HI AJ
Why are you using clear content the code you using is different in the URL wait for 2 hours I will give you the code for downloading.

Thanks
Harry
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:AJ0424
ID: 22708005
Hi Harry,
I am not sure I understood your question but I have a partial solution on my end and wanted to let you know before you spent too much time trying to help me find a solution.  

I changed my 'download' button to a hyperlink template field and I use that to pass my file id to (primary key) to a new page.  (code snip below)  I will run the actual file download from this new page.  (I actually did this two different ways on two separate columns because I was trying to figure out the best way to accomplish the task.)

I then created a new stored proc that takes the id and returns the file name and file path.  I am going to use these to fill out the two parameters I need:

Response.AddHeader("Content-Disposition", "attachment; filename=" + [myfilename]);
Response.TransmitFile([myfilepath]);

I haven't figured out quite how to pull the results from my stored proc into my page yet but I am further along than I was.

Thanks!
AJ


Column 1: I edited the NavigateURL databinding in the gridview hyperlink template to:
 
Eval("ID", "DownloadFile.aspx?ID={0}")
 
Column 2: 
 
        protected void GridView1_RowDatabound(object sender, GridViewRowEventArgs e)
        {
 
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HyperLink download = ((HyperLink)e.Row.FindControl("HyperLink1"));
                DataRowView row = (DataRowView)e.Row.DataItem;
                download.NavigateUrl = String.Format("DownloadFile.aspx?ID={0}", row["ID"]);
            }
 

Open in new window

0
 
LVL 5

Accepted Solution

by:
harwantgrewal earned 500 total points
ID: 22708075
Thats how I am using it to download file to excel, Where you just pass the filename for the downloading file.
You can also do the way you have done.

Harry
 public static void ExportDataSetToExcel(DataSet ds, string filename)
       {
            HttpResponse response = HttpContext.Current.Response;
 
            // first let's clean up the response.object
            response.Clear();
            response.Charset = "";
 
            // set the response mime type for excel
            response.ContentType = "application/vnd.ms-excel";
            response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
 
            // create a string writer
            using (StringWriter sw = new StringWriter())
            {
               using (HtmlTextWriter htw = new HtmlTextWriter(sw))
               {
                    // instantiate a datagrid
                    DataGrid dg = new DataGrid();
                    dg.DataSource = ds.Tables[0];
                    dg.DataBind();
                    dg.RenderControl(htw);
                    response.Write(sw.ToString());
                    response.End();
               }
            }
        }

Open in new window

0
 

Author Comment

by:AJ0424
ID: 22708142
Thanks for all your help!
AJ
0
 

Author Closing Comment

by:AJ0424
ID: 31505520
Thanks again - I am really a beginner and some of this is really complicated to me.  I appreciate the help!

AJ
0

Featured Post

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question