Ti faccio un esempio, ma bada, funziona benissimo con IE7, Opera9 e firefox 3, ma non ne ho capito il motivo.
Dunque, in una directory metti immagini con questi nomi:
A'B à è é ì ò ù.JPG
High School Musical 1 & 2 (2 Dvd).jpg
il 7 e l'8.jpg
Il Gatto... E Il Cappello Matto.jpg
Iron Man (Disco Singolo).jpg
Koda, Fratello Orso (Dvd+Libro).jpg
scarica dalla rete le librerie lightbox
pagina aspx
codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="lista_immagini.aspx.vb" Inherits="CorsoApogeo_wrox_comandi_ed_associazione_di_dati_ListView_lista_immagini_da_directory_lista_immagini" %>
<%@ Import Namespace="l=libreria.ModuloWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Lista immagini con nomi "strani"</title>
<link rel="stylesheet" href="../../../../../js/lightbox/css/lightbox.css" type="text/css" media="screen" />
<link href="lista_immagini.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
<script src="../../../../../js/lightbox/js/prototype.js" type="text/javascript"></script>
<script src="../../../../../js/lightbox/js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="../../../../../js/lightbox/js/lightbox.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<h3>Lista immagini da directory con nomi "strani"</h3>
<div>
<asp:ListView ID="ListView1" runat="server" EnableViewState="false" GroupItemCount="3">
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</tr>
</GroupTemplate>
<LayoutTemplate>
<table class="professionale_2" cellspacing="0" cellpadding="4">
<tr><th align="center" colspan="3">Lista immagini da directory</th></tr>
<asp:PlaceHolder ID="groupPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<td align="center">
<table class="semplice">
<tr>
<td align="center">
<a href="<%#Eval("LogicName") %>" rel="lightbox" title="<%#Eval("FullName") %>" >
<img alt="<%#Eval("Name") %>" src="<%#Eval("LogicName") %>" title="<%#Eval("Name") %>" width="100" style="border:none;" />
</a>
</td>
</tr>
<tr><td align="center"><%#Eval("Name") %></td></tr>
</table>
</td>
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
pagina vb
codice:
Option Strict On
Imports l = libreria.ModuloWeb
Partial Class CorsoApogeo_wrox_comandi_ed_associazione_di_dati_ListView_lista_immagini_da_directory_lista_immagini
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'tutti i file di C:\dati\ProveNikon\images
'con estensione jpg
'dim dimensione < 40000 byte
'ordinati per nome
'option ha text:= nome file, value:= percorso completo
Dim di As New DirectoryInfo(Server.MapPath("./"))
Dim result = From fi In di.GetFiles("*.jpg") _
Where fi.Length < 4000000 _
Order By fi.Name _
Select New With {.Name = fi.Name, .FullName = fi.FullName, .LogicName = "./" & fi.Name}
Dim g As ListView = Me.ListView1
g.DataSource = result
g.DataBind()
End Sub
End Class
foglio di stile
codice:
body
{
background-color: white;
color: #000000;
font-family: Verdana, Helvetica, sans-serif;
font-size: 8pt;
font-weight: normal;
letter-spacing: normal;
text-transform: none;
word-spacing: normal;
}
H3
{
COLOR: #003366;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14pt;
font-weight: 600;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
}
table.professionale_2
{
background-color: White;
border: 1px #CCCCCC solid;
border-collapse: collapse;
font-size: 10pt;
}
.professionale_2 tr
{
color: #000066;
background-color: white;
}
.professionale_2 tr.alternato
{
color: Black;
background-color: white;
}
.professionale_2 tr.header, .professionale_2 tr th
{
color: White;
background-color: #006699;
font-weight: bold;
text-align: center;
}
.professionale_2 td, .professionale_2 th
{
border: 1px #CCCCCC solid;
}
table.semplice
{
background-color: White;
border: none;
border-collapse: collapse;
font-size: 8pt;
}
.semplice tr
{
color: #000066;
background-color: white;
}
.semplice tr.alternato
{
color: Black;
background-color: white;
}
.semplice tr.header, .semplice tr th
{
color: White;
background-color: #006699;
font-weight: bold;
text-align: center;
}
.semplice td, .semplice th
{
border: none;
}