asp.net vb编程
在数据库中读取文件名添加到listbox中,如何在listbox中实现双击打开下载事件,事件触发后如何编写下载代码!!!!!!
请高人指点!!!!
------解决方案--------------------------------------------------------
onclick:
string strFileName = list.SelectedValue;
fi = new System.IO.FileInfo(strFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
//Response.Charset = "utf-8 ";
//Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = ContentType;
//Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + HttpUtility.UrlEncode(fi.FullName, System.Text.Encoding.UTF8));
Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + fi.Name);
Response.AppendHeader( "Content-Length ", fi.Length.ToString());
Response.WriteFile(fi.FullName);
Response.Flush();
Response.Close();
------解决方案--------------------------------------------------------
<ASP:LISTBOX id= "ListBox1 " ondblclick= "javascript:GoDownLoad(); " runat= "server " Width= "152px " Height= "126px "> <ASP:LISTITEM Value= "1 "> A </ASP:LISTITEM> <ASP:LISTITEM Value= "2 "> b </ASP:LISTITEM> <ASP:LISTITEM Value= "3 "> c </ASP:LISTITEM> </ASP:LISTBOX>