本文介绍了ASP.NET - 图片没有显示出来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经把母版页上的图像。

我看到的图像在设计时。

但我没有看到的图像在运行时。

可以是什么问题?

我试图将图像放在上的图像框。但它并不能工作。

 <%@主语言=C#AutoEventWireup =真codeBehind =MasterPage.master.cs继承=Ice_Web_Portal.UI.MasterPageEnableTheming = 真正的%GT;!< D​​OCTYPE HTML PUBLIC -  // W3C // DTD XHTML 1.0过渡// ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">< HTML的xmlns =htt​​p://www.w3.org/1999/xhtml>
<头=服务器>
    <标题方式> :: ICE门户网站::< /标题>
    <链接HREF =App_Themes文件/ SmokeAndGlass / SmokeAndGlass.css的rel =stylesheet属性类型=文/ CSS/>
< /头>
<身体GT;
    <表ID =form1的=服务器>
        <表样式=的位置是:静态>
            &所述; TR>
                < TD align =left合并单元格=2>
                    < ASP:图片ID =Image1的=服务器的ImageUrl =〜/ App_Themes文件/ Banner.JPG/>< / TD>
                &所述; TD>
                < / TD>
            < / TR>
            &所述; TR>
                &所述; TD行跨度=2>
                    < D​​IV>
                    &安培; NBSP;< / DIV>
                    &安培; NBSP;< / TD>
                < TD风格=WIDTH:3PX>
                    < ASP:LoginView ID =LoginView1=服务器>
                        <&显示LoggedInTemplate GT;
                            <表样式=WIDTH:204px>
                                &所述; TR>
                                    &所述; TD>
                                        登录状态:其中; / TD>
                                    &所述; TD>
                    < ASP:LoginStatus ID =LoginStatus1=服务器/>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                < / TR>
                                &所述; TR>
                                    &所述; TD>
                                        登录名:LT; / TD>
                                    &所述; TD>
                    < ASP:LoginName将ID =LoginName1=服务器/>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                < / TR>
                                &所述; TR>
                                    &所述; TD>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                < / TR>
                                &所述; TR>
                                    &所述; TD>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                    &所述; TD>
                                    < / TD>
                                < / TR>
                            < /表>
                        < /&显示LoggedInTemplate GT;
                    < / ASP:LoginView>
                < / TD>
                &所述; TD>
                < / TD>
            < / TR>
            &所述; TR>
                < TD风格=WIDTH:3PX>
                    < ASP:的ContentPlaceHolder ID =ContentPlaceHolder1=服务器>
                    < / ASP:&的ContentPlaceHolder GT;
                < / TD>
                &所述; TD>
                < / TD>
            < / TR>
            &所述; TR>
                &所述; TD>
                    &安培; NBSP;< / TD>
                < TD风格=WIDTH:3PX>
                < / TD>
                &所述; TD>
                < / TD>
            < / TR>
        < /表>
    < /表及GT;
< /身体GT;
< / HTML>


解决方案

这听起来像你可能有某种形式的URL映射问题...对于ImageUrl属性尝试将其设置为〜/图片/ MYIMAGE巴纽 ...

而不是直接在App_Theme文件夹存储图像,创建图像的文件夹,并尝试使用替代。 App_Theme文件目录的处理方式不同...

I have placed an image on the master page.

I see the image at design time.

But I don't see the image at run time.

What can be the problem?

I have tried to place the image on an image box. But it didn't work either.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="Ice_Web_Portal.UI.MasterPage" EnableTheming="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>.::ICE Web Portal::.</title>
    <link href="App_Themes/SmokeAndGlass/SmokeAndGlass.css" rel="stylesheet" type="text/css" />
</head>
<body >
    <form id="form1" runat="server">
        <table style="position: static">
            <tr>
                <td align="left" colspan="2">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Banner.JPG" /></td>
                <td>
                </td>
            </tr>
            <tr>
                <td rowspan="2">
                    <div>
                    &nbsp;</div>
                    &nbsp;</td>
                <td style="width: 3px">
                    <asp:LoginView ID="LoginView1" runat="server">
                        <LoggedInTemplate>
                            <table style="width: 204px">
                                <tr>
                                    <td>
                                        Login Status :</td>
                                    <td>
                    <asp:LoginStatus ID="LoginStatus1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Login Name :</td>
                                    <td>
                    <asp:LoginName ID="LoginName1" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </LoggedInTemplate>
                    </asp:LoginView>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="width: 3px">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td style="width: 3px">
                </td>
                <td>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
解决方案

It sounds like you may have a URL mapping issue of some kind... For the ImageURL property try setting it to "~/Images/MyImage.png"...

Rather than storing an image directly in the App_Theme folder, create a folder for images and try to use that instead. The App_Theme directory is handled differently...

这篇关于ASP.NET - 图片没有显示出来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 04:41