调整 jQuery 幻灯片以与 ASP 转发器配合使用
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
Try
我已经尝试过你的代码并找到了答案。最后,它也解决了我的问题。如果对您有用,请标记为答案。
这是您的旧代码
,将其更改为
用单引号
''
替换双引号""
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
change it to
replace the double quotes
""
with single quotes''