我是编程新手,尤其是jQuery。
我正在尝试使用http://www.xdevsoftware.com/blog/post/Using-ColorBox-in-ASPNET.aspx中的示例使用ColorBox来显示相册中的照片,照片的详细信息是从数据库中存储和检索的。
一切正常,就像在DataList中显示所选相册的照片一样,问题是当我单击一张照片时,它会打开实际的照片,例如localhost:3478/FPOS_v2/uploads/08012011080.JPG,而不是使用coloBox来显示照片
下面是.aspx代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="ColorBox/colorbox.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" />
<script src="ColorBox/jquery.colorbox.js" type="text/javascript" />
<script type="text/javascript">
$(document).ready(function () {
$("a[rel='example1']").colorbox();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList runat="server" ID="dlColorBox"
RepeatColumns="3"
RepeatDirection="Horizontal">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl='<%# "~/uploads/"+Eval("OriginalFilePath") %>'
rel="example1"
Title='<%# Eval("FileName") %>'>
<asp:Image ID="Image1" runat="server"
ImageUrl='<%# "~/uploads/"+Eval("ThumbFilePath") %>'
Width="100"
Height="100"
BorderStyle="None" />
</asp:HyperLink>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
下面是vb.net代码:
Imports SqlHelper
Imports System.Data
Partial Class colorBoxDisplay
Inherits System.Web.UI.Page
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
DAL.connectionstring = ConfigurationManager.ConnectionStrings("fpaConnectionString").ConnectionString
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
BuildDataSet()
End Sub
Private Sub BuildDataSet()
Dim dataset As DataSet
dataset = SqlHelper.ExecuteDataset(DAL.connectionstring, "fpa_SP_album_view_by_id_gridview", 34)
dlColorBox.DataSource = dataset
dlColorBox.DataBind()
End Sub
有谁能告诉我怎么纠正这个错误吗?或者能够使用ColorBox在dlColorBox DataList中显示照片?
因此,它会显示所选相册中的照片,如分组照片1示例colorpowered.com/colorbox/core/example1/index.html
我是jQuery的新手,所以你能告诉我如何通过更改代码来实现这一点吗?因为我已经花了3天时间在互联网上查看不同的例子。
如有任何帮助,我们将不胜感激:)
谢谢
发布于 2011-02-02 19:29:05
检查正确加载的Colorbox javascript和css文件。并检查页面的html输出。
https://stackoverflow.com/questions/4873259
复制相似问题