调整 jQuery 幻灯片以与 ASP 转发器配合使用

发布于 2024-12-04 06:38:50 字数 621 浏览 2 评论 0原文

我正在使用 jquery 幻灯片,我想填充数据库中的图片。我正在尝试使用 ASP 转发器通过此代码在 div 中创建图像。

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsSelectedCategory" Visible="True">
        <ItemTemplate>
            <a><asp:Image ID="Image2" runat="server" ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>" class="slide" /></a>
        </ItemTemplate>
        </asp:Repeater>

我收到服务器标记格式不正确的错误,我猜测是这个位

ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>"

PictureFilePath 是数据库中保存文件名和文件扩展名的字段。所以我必须写出文件的路径,然后添加名称。

I'm using a jquery slideshow and I want to fill in the pictures from a database. I'm trying to use an ASP repeater to create the images in a div with this code.

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsSelectedCategory" Visible="True">
        <ItemTemplate>
            <a><asp:Image ID="Image2" runat="server" ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>" class="slide" /></a>
        </ItemTemplate>
        </asp:Repeater>

I'm getting the error that the server tag is not well formed and I'm guessing it is this bit

ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>"

PictureFilePath is a field in the database that holds the filename and extension of the file. So I have to write out the path to the file then add on the name.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鸠书 2024-12-11 06:38:50

尝试

ImageURL='<%# "~/img1/photos/" + Eval("PictureFilePath") %>'

Try

ImageURL='<%# "~/img1/photos/" + Eval("PictureFilePath") %>'
勿挽旧人 2024-12-11 06:38:50

我已经尝试过你的代码并找到了答案。最后,它也解决了我的问题。如果对您有用,请标记为答案。

这是您的旧代码

ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>"

,将其更改为

ImageURL='~/img1/photos/<%#Eval("PictureFilePath") %>'

用单引号 '' 替换双引号 ""

I have tried your code and found the answer. Finally, it solved my problem as well. Just mark as answer if worked for you.

This is your old code

ImageURL="~/img1/photos/<%#Eval("PictureFilePath") %>"

change it to

ImageURL='~/img1/photos/<%#Eval("PictureFilePath") %>'

replace the double quotes "" with single quotes ''

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文