【发布时间】:2017-07-14 11:30:31
【问题描述】:
我目前正在使用 ASP.NET 和 C# 开发一个网站。在这个网站上,我展示了 2 组图像横幅,第一组充满了我的 C# 代码并保持静止(不改变)。
<div class="divArticleCar">
<div id="OwlDemo" class="owl-carousel owl-theme" style="padding:25px;" runat="server">
</div>
<div class="customNavigation ">
<a class="btn prev "><span class="glyphicon glyphicon-menu-left"></span><br/></a>
<a class="btn next "><span class="glyphicon glyphicon-menu-right"></span><br/></a>
</div>
</div>
第二个使用从图像数据库到外部 API 的连接。我有一个文本输入和一个按钮,因此当用户搜索关键字时,第二个横幅会更新为新图像。我正在使用 AJAX <asp:UpdatePanel> 标签来更新图像结果。
<asp:UpdatePanel runat="server" id="UpdatePanel2" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger controlid="btnSearchImage" EventName="ServerClick" />
</Triggers>
<ContentTemplate>
<div class="divArticleCar">
<div id="OwlDemo2" class="owl-carousel owl-theme" style="padding:25px;" runat="server">
</div>
<div class="customNavigation CN2">
<a class="btn prev2 ">
<span class="glyphicon glyphicon-menu-left"></span> <br>
</a>
<a class="btn next2 ">
<span class="glyphicon glyphicon-menu-right"></span> <br>
</a>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
问题在于 ContentTemplate 中的图像何时更新。它们只是没有显示,横幅消失了。我检查了我的背景代码,C# 正在获取 API 结果,它正在添加新图像,它们只是不可见。横幅由 2 个 Javascript 文件管理。
第一:carrusel.js
有人知道为什么图像消失了吗?
【问题讨论】:
-
不管你的特定堆栈,你仍然输出
HTML+CSS+JS。如果您可以提供问题的minimal reproducible example,我们可以告诉您CSS规则或JavaScript函数确定元素的当前状态,您可以跟踪它的源并修复它,或者,您可以执行更严格的规则以正确显示您的元素。您的浏览器控制台中有什么有趣的东西吗?
标签: javascript c# jquery html asp.net