ASP.Dot.NET.2.0.Revealed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

ASP.Dot.NET.2.0.Revealed [Electronic resources] - نسخه متنی

Patrick A. Lorenz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Fun Pet Trick #7: Creating a Thumbnail List in About 1 Minute

By Patrick A. Lorenz

This Fun Pet Trick shows how to create a thumbnail list of all images placed in a given directory. All you need is the DynamicImage control, a DataList, and the System.IO namespace. Here you go:


<%@ page language="C#" %>
<%@ import namespace="System.IO" %>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
DirectoryInfo directory = new
DirectoryInfo(Path.GetDirectoryName(this.Request.PhysicalPath));
this.DL_Thumbnails.DataSource = directory.GetFiles("*.gif");
this.DL_Thumbnails.DataBind();
}
</script>
<html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server">
<asp:datalist runat="server" id="DL_Thumbnails" repeatcolumns="2">
<itemtemplate>
<asp:dynamicimage runat="server"
imagefile='<%# Eval("Name") %>'
width="150px">
</asp:dynamicimage>
</itemtemplate>
</asp:datalist>
</form>
</body>
</html>

What the sample actually does is scale all GIFs in the pages directory to 150 pixels width and displays them in the browser.

Have I already mentioned that I love the new DynamicImage control? Well, I do! ;-)

/ 133