download problem asp.net
<p>Hi this is the current version......please help.</p>

<p>&lt;%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="FormDownload.aspx.cs" Inherits="Default2" Title="Form Download" %></p>

<p>




 
                
                    
                        
                            '>
                        
                    
                    
                    
                
                
                
                
                
                
                
                
            
</p>

<p>using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;</p>

<p>public partial class Default2 : System.Web.UI.Page
{
    private void BindGrid()
    {
        DirectoryInfo dir = new DirectoryInfo("D:/Pilabs Projects/GlobeDse/globedse website/globedse.com/Uploads");
        FileInfo[] files = dir.GetFiles();
        GridView1.DataSource = files;
        GridView1.DataBind();</p>

<pre><code>}

protected void Page_Load(object sender, EventArgs e)
{


    if (!Page.IsPostBack)
    {
         BindGrid();
    }




}

private void Downloadfile(String fileName, String FullFilePath)
{

    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
    Response.TransmitFile(FullFilePath);
    Response.End();


}

protected void GridView1_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
{
    if (e.CommandName == "Download")
    {
        String[] fileInfo = e.CommandArgument.ToString().Split(';');
        String FileName = fileInfo[1].ToString();
        String FullPath = fileInfo[0].ToString();
        Downloadfile(FileName, FullPath);
    }

}


protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

    GridView1.PageIndex = e.NewPageIndex
    BindGrid();


}
</code></pre>

<p>}</p>
