Solved

Table Background image from usercontrol is not visible

Posted on 2006-07-13
7
1,122 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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 discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

15 Experts available now in Live!

Get 1:1 Help Now