dear i am in problem to download .zip file in computer . my recomendation is bellow.
Text='<%#Eval("zip")%>'>LinkButton
------------------------
source code
-----------------------
Premier1888bdDataContext db = new Premier1888bdDataContext();
protected void Button1_Click(object sender, EventArgs e)
{
string a = TextBox1.Text;
var st1 = from s in db.POInfos where s.PONO == a select s;
GridView2.DataSource = st1;
GridView2.DataBind();
}
Input pono
When i click the link in grid view this file download in F/ in computer.
my file location is "~/Web/Files/dragpanel1.zip"
If any body help me by giving Source code best regurds. thanks.
| Select | PONO | Project | ByerName | ShipmentDate | zip | ||
|---|---|---|---|---|---|---|---|
| dragpanel1.zip | 20 | PTL | Ikei | 2/2/2013 12:00:00 AM | dragpanel1.zip |
When i click the link in grid view this file download in F/ in computer.
my file location is "~/Web/Files/dragpanel1.zip"
If any body help me by giving Source code best regurds. thanks.

Satyapriya NayakPosted Mar 6, 2013, 12:33 AM
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.Data.SqlClient;
namespace WebApplication16
{
public partial class WebForm1 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "cmd")
{
string filename = e.CommandArgument.ToString();
string path = MapPath("~/filename/" + filename);
byte[] bts = System.IO.File.ReadAllBytes(path);
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "Application/octet-stream");
Response.AddHeader("Content-Length", bts.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.BinaryWrite(bts);
Response.Flush();
Response.End();
}
}
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from test";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds,"test");
GridView1.DataMember = "test";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from test where id = '" + TextBox1.Text + "'";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "test");
con.Close();
GridView1.DataSource = ds;
GridView1.DataMember = "test";
GridView1.DataBind();
}
}
}