Solved

Table Background image from usercontrol is not visible

Posted on 2006-07-13
7
1,125 Views
Last Modified: 2012-05-05
HI,

I have a table in a usercontrol (ascx)that has a background images. The image it is not visible on the page (aspx) when the usercontrol is loaded.

The code from the control is as followed:

<table id="TABLE1" runat="server">
    <tr>
        <td align="center" style="background-image: url(../Styles/HeaderBg.gif); width: 400px;
            height: 40px; font-weight: bold; color: #848067; font-family: Arial;" id="TD1" runat="server">
            The text that is placed on the image</td>
    </tr>
</table>

0
Comment
Question by:bemiu
7 Comments
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17106297
try setting background image not with style tag but with background tag. Like:
<td background="myimage.jpg">
0
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17106304
or try adding background-color:Transparent to style tag
0
 

Author Comment

by:bemiu
ID: 17106708
Hi Ramuncikas

Thanks for your reply !

The table doesn't have a property called "background" so I can't use that.  
The problem is loading a picture and not a #color. The color is loaded in the aspx page. :-)

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17106734
I'm not talking about table (<TABLE>), I'm talking about tablecell (<TD>)
0
 

Author Comment

by:bemiu
ID: 17106813
Sorry...but it's the same for the cell. I have made a test page with a control and even it was not a property i ren the control on the page....nothing was shown
0
 
LVL 7

Expert Comment

by:irps20001
ID: 17107310
it must be showing an "x" icon in place of Image place. Just right click on the "x" ( where the image not showing ) and check for the Image properties, whether its loading from the proper place or is it going to somewhere to load the image. This may help

HTH
0
 
LVL 5

Accepted Solution

by:
bullrout earned 500 total points
ID: 17107620
hi There,

I'd be checking the path to the image just like irps20001 suggested.
Then i'd be more inclined to do this with a stylesheet. I have created a reference to a stylesheet and then placed the call to the image in it. When the page loads I have created a cell at runtime just as a place setter for the bg image to illustrate that the image is loading.

You can adapt the code to your needs, I hope this helps

Sean



make sure that the stylesheet reference is in the head of the document.

<style type="text/css">@import url( styles.css );
      </style>

!--- page code

<asp:Table id="Table4" runat="server"
                        BackColor="#ffffff" Width="412px" EnableViewState="False" BorderWidth="1" BorderColor="#F0027F"
                        Font-Size="8pt" Font-Name="Verdana" CellPadding="4" CellSpacing="0" Gridlines="Both"></asp:Table>

!--- stylesheet code

table
{
      background-image: url(images/bgmain.jpg);
}

!-- vb code

Dim r As TableRow = New TableRow
        Dim c As TableCell

        c = New TableCell
        c.Controls.Add(New LiteralControl("eeeeeee"))
        c.HorizontalAlign = HorizontalAlign.Center
        c.VerticalAlign = VerticalAlign.Top
        c.Width = Unit.Pixel(40)
        r.Cells.Add(c)
        Table4.Rows.Add(r)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question