【问题标题】:No Image on IE browser when using Image Button or Button Field in Grid View在网格视图中使用图像按钮或按钮字段时,IE 浏览器上没有图像
【发布时间】:2017-11-17 04:34:43
【问题描述】:

有谁知道为什么我在使用 IE(所有版本)作为浏览器时会遇到这个问题?该图像在 Chrome 上完美运行,但在 IE 上无法正常运行。

这是我正在谈论的示例屏幕截图:

IE:

当我使用 Chrome 尝试此操作时,它按预期工作。

铬:

这是我在网上找到的代码。

<asp:GridView ID="gvJobs" runat="server" OnRowCommand="gvJobs_RowCommand">
    <Columns>
        <%--<asp:ButtonField ButtonType="Image" CommandName="btnExtract_Click" ImageUrl="~/images/icons/ExcelLogo.png" CausesValidation="false" />--%>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:ImageButton ID="btnExtractId" AutoPostback="true" runat="server" 
                    ToolTip="Calibration Form" CommandName="btnExtract_Click" CausesValidation="false" ImageUrl="~/images/icons/ExcelLogo.png" /> 
            </ItemTemplate>
        </asp:TemplateField>
        <asp:HyperLinkField HeaderText="Job Reference" DataTextField="JobReference" DataNavigateUrlFields="JobId" DataNavigateUrlFormatString="job.aspx?jobid={0}" />
        <asp:BoundField HeaderText="Job Type" DataField="JobTypeName" />
        <asp:BoundField HeaderText="Business Unit" DataField="BusinessUnitName" />
        <asp:BoundField HeaderText="Client" DataField="ClientFullname" />           
        <asp:BoundField HeaderText="Planned Completion Date" DataField="PlannedCompletionDate" DataFormatString="{0:dd/MM/yyyy}" />
        <asp:HyperLinkField HeaderText="Parent Job" DataTextField="ParentJobReference" DataNavigateUrlFields="ParentJobId" DataNavigateUrlFormatString="job.aspx?jobid={0}" Visible="false" />
    </Columns>
</asp:GridView>

我已经尝试了这两个控件,但在这个问题上仍然没有运气。我也在互联网上寻找解决方案,但它并没有帮助我解决我的问题。

提前感谢可以帮助我的人。

【问题讨论】:

    标签: c# asp.net gridview imagebutton buttonfield


    【解决方案1】:

    我已经用静态值尝试过你的代码并且它工作正常。 我猜你需要清除 Internet Explorer 的缓存。或按ctrl + F5

    无论是缓存在 chrome 还是 IE 上,您还需要在清除缓存后检查文件是否存在。

    这里我们使用您的代码截取屏幕截图。

    如果您需要任何帮助,请告诉我

    【讨论】:

    • 感谢@Manoj Bhardwaj 的帮助,但仍然遇到同样的问题。就像 IE 中缺少图像一样,仍然不知道为什么,因为它在 Chrome 中有效。你有什么其他的建议?再次感谢。
    • 您能否在开发者工具中检查后分享您的屏幕或屏幕截图。我的 gmail id 是 manoj.creatives@gmail.com
    • 嗨@Manoj Bhardwaj,我已经把它发送到你的gmail帐户了。谢谢:)
    • 您是否清除了 chrome 浏览器的缓存?我需要实时查看代码。你能分享你的 Skype id 吗?
    • 看起来不错。你能帮我一个忙吗从谷歌下载一个在 IE 上打开的 .PNG 文件,然后提供参考。只是为了测试。如果可行,则图像存在一些问题。 Chrome 是一款高级浏览器,因此它可以打开损坏的文件,而 IE 则不能。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 2015-10-14
    相关资源
    最近更新 更多