且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在数据列表中单击一次下载多个文件

更新时间:2022-12-26 19:19:25


用于在数据列表中单击一次下载多个文件的代码



code for download multiple file in single click in datalist


<asp:Button runat="server" ID="btn1" OnClick="btn1_Click" Text="DownLoad Multiple Files" />
    <asp:Repeater runat="server" ID="rptr">
        <ItemTemplate>
            <iframe src="<%#Container.DataItem%>"></iframe>
        </ItemTemplate>
    </asp:Repeater>





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.Collections.Generic;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn1_Click(object sender, EventArgs e)
    {
        List<string> files = new List<string>();
        files.Add("data1.zip");
        files.Add("data2.zip");
        files.Add("data3.zip");
        files.Add("data4.zip");
        rptr.DataSource = files;
        rptr.DataBind();
    }




它也可能对您有所帮助.单击此处




It may also help you. click here


单击,您需要获取所选文件,将其压缩并推送到客户端.

http://***.com/questions/2670263/asp-net-download- all-files-as-zip [ ^ ]
At the click, you need to get the selected files, zip them, and push to client.

http://***.com/questions/2670263/asp-net-download-all-files-as-zip[^]