1. 程式人生 > 其它 >java移位運算子對右側引數進行模運算

java移位運算子對右側引數進行模運算

首先需要Ionic.Zip.dll 頁面前臺

<body>
<form id="form1" runat="server">
<p>
    <asp:Button ID="PackDown" runat="server" Text="打包下載" OnClick="PackDown_Click" /></p>
<asp:GridView ID="GridView1" runat="server" Width="500px"
    CellPadding="8" CellSpacing="1">
    <Columns>
        <asp:TemplateField HeaderText=""
InsertVisible="False"> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </ItemTemplate> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField> <asp:TemplateField HeaderText="檔案列表" InsertVisible="
False"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </form> </body> 頁面後臺CS程式碼:
void BindFilesList() { string strSql = "select Name from tableC"; DataTable dt = m_db.ExecuteDataTable(strSql); GridView1.DataSource = dt; GridView1.DataBind(); } protected void PackDown_Click(object sender, EventArgs e) { Response.Clear(); Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=DotNetZip.zip"); using (ZipFile zip = new ZipFile(System.Text.Encoding.Default)) { foreach (GridViewRow gvr in GridView1.Rows) { if (((CheckBox)gvr.Cells[0].Controls[1]).Checked) { zip.AddFile(Server.MapPath("SoftwareDownload/") + (gvr.Cells[1].Controls[1] as Label).Text, ""); } } zip.Save(Response.OutputStream); } Response.End(); } 重點參考後臺CS裡的PackDown_Click方法