Click here to Skip to main content
13,448,729 members (53,582 online)
Click here to Skip to main content


8 bookmarked
Posted 13 May 2010

Dynamic DeepZoom ASP.NET User Control using Seadragon

, 19 May 2010
A deepzoom user control doesn't need to generate deepzoom image files
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DeepZoom.ascx.cs" Inherits="DeepZoom" %>
<div id="container" runat="server" style="width: 400px; height: 300px; background-color: black;">
    <input id="width" type="hidden" runat="server" />
    <input id="height" type="hidden" runat="server" />
    <input id="imageUrl" type="hidden" runat="server" />
    <input id="tileSize" type="hidden" runat="server" value="256" />
    <input id="tileOverlap" type="hidden" runat="server" value="1" />
<script type="text/javascript" src=""></script>
<script type="text/javascript">
    function Init() {
        var width = parseInt(document.getElementById("<%= width.ClientID %>").value);
        var height = parseInt(document.getElementById("<%= height.ClientID %>").value);
        var imageUrl = document.getElementById("<%= imageUrl.ClientID %>").value;
        var tileSize = parseInt(document.getElementById("<%= tileSize.ClientID %>").value);
        var tileOverlap = parseInt(document.getElementById("<%= tileOverlap.ClientID %>").value);
        var tileSource = new Seadragon.TileSource(width, height, tileSize, tileOverlap);
        tileSource.getTileUrl = function (level, x, y) {
            return "GetTileImage.ashx?level=" + level + "&x=" + x + "&y=" + y +
                   "&tileSize=" + tileSize + "&tileOverlap=" + tileOverlap + "&image=" + imageUrl;

        var container = document.getElementById("<%= container.ClientID %>");
        var viewer = new Seadragon.Viewer(container);

    Seadragon.Utils.addEvent(window, "load", Init);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Lang Deng
Web Developer
United States United States
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180318.3 | Last Updated 20 May 2010
Article Copyright 2010 by Lang Deng
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid