Solved

Table Background image from usercontrol is not visible

Posted on 2006-07-13
7
1,123 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now