Asp.Net 网页不会在页面加载时加载图像,但会在单击按钮时加载图像
我面临的场景是在 Asp.Net 列表视图控件中显示一些图像。 在 Visual Studio 调试模式下一切正常,但是当我部署网站时出现以下问题。
场景- 在页面加载事件中,我调用 BindData() 方法,该方法获取数据并将数据绑定到列表视图中。我有一个搜索按钮,它也调用 BindData() 并绑定相同的列表视图控件。
问题 - 当我部署网站并打开页面时,图像未加载。但是当我单击搜索按钮时,图像是可见的。
列表视图内的图像标签
I am facing a scenario where I have displayed some images in Asp.Net List view control.
Everything works fine in visual studio debug mode, but the below problem occurs when I deploy the website.
Scenario- On the page load event, I call a method BindData() and this method fetches the data and binds the data in List view. I have a search button which also calls the BindData() and binds the same list view control.
Problem- When I deploy the website and open the page, the images are not loaded. But when I click search button, the images are visible.
Image tag inside List View
<asp:ImageButton ID="lnkHistory" runat="server" CommandName="History" CommandArgument='<%#Eval("RecordID") %>' Height="20px" Width="20px" ImageUrl="~/Images/History.png" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,网络表单可能会很棘手。
听起来像是与浏览器或本地脚本有关。
尝试以下操作:
Webforms can be tricky with these sometimes.
Sounds like something to do with either the browser or the local scripts.
Try the following: