Asp.Net 网页不会在页面加载时加载图像,但会在单击按钮时加载图像

发布于 2025-01-13 08:26:31 字数 668 浏览 2 评论 0原文

我面临的场景是在 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" />

List View image on page load

List View image showing images after clicking search button

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

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

发布评论

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

评论(1

酸甜透明夹心 2025-01-20 08:26:31

有时,网络表单可能会很棘手。

听起来像是与浏览器或本地脚本有关。
尝试以下操作:

  1. 不同的浏览器
  2. 尝试不同的图像
  3. 更改高度和宽度宽度。看看有什么帮助

Webforms can be tricky with these sometimes.

Sounds like something to do with either the browser or the local scripts.
Try the following:

  1. Different Browser
  2. Try a different image
  3. Change the Height & Width. See if anything helps
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文