New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

WebForms ZipLibrary Overview


Chrysanthemum.jpg
Desert.jpg
Hydrangeas.jpg
Jellyfish.jpg
Koala.jpg
Lighthouse.jpg
Penguins.jpg
Tulips.jpg

This sample demonstrates how with the API provided by Telerik’s ZIP framework you can easily compress data into a ZIP file. In order to save data in a ZIP file, you can take advantage of the ZipArchive and ZipArchiveEntry classes and their methods.

About RadZipLibrary for ASP.NET AJAX

The ZipLibrary allows you to load data from existing ZIP files or create and edit ZIPs that can be used by other applications. You can also create ZIP files in memory or use a stream to get data and add it to a ZIP file. With the Telerik ZipLibrary's API you can compress and decompress streams.

RadZipLibrary and 120+ other controls are part of UI for ASP.NET AJAX, a comprehensive toolset taking care of the common functionality of your application, while leaving you with more time to work on its business logic.

Key Features

  • Load data from existing Zip files.
  • Load data from Stream.
  • Save data in Zip files.
  • Save data in in-memory stream.
  • Store your data in the Isolated Storage.
  • Support for large files.
  • Compress and decompress streams.

In order to use the ZipLibrary in your application, you need to add a reference to the Telerik.Windows.Zip.dll assembly. This is a cross-platform library that allows you to load, create and update ZIP archives on the fly and provides a convenient API to work with. The assembly will be automatically added to the Bin folder when you create a Telerik Web Forms site or you can manually find it in the AdditionalLibraries section in the Telerik UI for ASP.NET AJAX installation folder.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
    • DefaultVB.aspx.vb
    • ZipLibraryDataProvider.vb
  • scripts.js
  • styles.css
<%@ Page Language="vb" AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.ZipLibraryVB.Overview.DefaultVB" %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js" type="text/javascript"></script>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function pageLoad()
            {
                listView = $find("<%= RadListView1.ClientID %>");
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container">
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" MinDisplayTime="200" />
        <telerik:RadButton RenderMode="Lightweight" runat="server" Text="Download selected images" ID="Button1" OnClick="Button1_Click"></telerik:RadButton>
        <telerik:RadButton RenderMode="Lightweight" Text="Download all images" ID="Button2" OnClick="Button2_Click" runat="server"></telerik:RadButton>
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" CssClass="list">
            <br />
            <telerik:RadListView OnNeedDataSource="RadListView1_NeedDataSource" runat="server" ID="RadListView1"
                AllowPaging="true" AllowMultiItemSelection="true" PageSize="10" DataKeyNames="Id">
                <LayoutTemplate>
                    <div class="list">
                        <div style="clear: both;">
                        </div>
                        <asp:Panel ID="itemPlaceholder" runat="server">
                        </asp:Panel>
                        <div style="clear: both;">
                        </div>
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <div style="float: left; margin: 5px; padding: 2px; position: relative; background: #eeeeee;"
                        class="myClass" onclick='ToggleSelection("Select", "<%# Container.DataItemIndex %>");'>
                        <telerik:RadBinaryImage Style="cursor: pointer; display: block;" runat="server" ID="RadBinaryImage1"
                            DataValue='<%#Eval("Data") %>' Height='200px' Width="200px"
                            ResizeMode="Fit"
                            AlternateText='<%#Eval("Name") %>' ToolTip='<%#Eval("Name") %>' />
                    </div>
                </ItemTemplate>
                <SelectedItemTemplate>
                    <div style="float: left; margin: 5px; padding: 2px; position: relative; background: #eeeeee;"
                        onclick='ToggleSelection("Deselect","<%# Container.DataItemIndex %>");'>
                        <telerik:RadBinaryImage Style="cursor: pointer; display: block;" runat="server" ID="RadBinaryImage1"
                            DataValue='<%#Eval("Data") %>' Height='200px' Width="200px"
                            ResizeMode="Fit"
                            AlternateText='<%#Eval("Name") %>' ToolTip='<%#Eval("Name") %>' />
                        <asp:Image CssClass="selected" ID="Image1" ImageUrl="~/ZipLibrary/Examples/Overview/Img/selected_img.png" AlternateText="Selected item" runat="server" />

                    </div>
                </SelectedItemTemplate>
            </telerik:RadListView>
        </telerik:RadAjaxPanel>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance