The background image for a table column is not getting displayed?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jagdeep gupta
    New Member
    • Aug 2010
    • 98

    The background image for a table column is not getting displayed?

    Here i use image in background in table column it does not displays the image but if i apply the same path for img tag in foreground it displays.

    Here is code:
    Code:
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
    
    <!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>Untitled Page</title>
       
        
       
        
        
       
        <style type="text/css">
            .style1
            {
                width: 50px;
                height: 323px;
            }
            .style2
            {
                width: 650px;
                height: 323px;
            }
        </style>      
       
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <table>
        <tr>
        <td style="width:30px; height:20px;">
            <img src="Image/Blue%20hills.jpg" 
                style="height: 83px; width: 734px;" />
        </td>
        </tr>
        <tr>
        <td>
        <table>
        <tr>
        <td style="background-image:url('<%= ResolveUrl("~/Image/Bluehills.jpg") %>');"  class="style1">
        <img src="Image/Water.jpg" height="60px" width="100px" />
        </td>
        <td class="style2" style="background-image:url('~/Image/Bluehills.jpg');">
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
            
            </asp:ContentPlaceHolder>
        </td>
        </tr>
        </table>
        </td>
        </tr>
        <tr>
        
        <td>
        reserved &copy; softech infoways
        </td>
        </tr>
        </table>
            
        </div>
        </form>
    </body>
    </html>
  • Sudaraka
    New Member
    • Jan 2011
    • 55

    #2
    Check the HTML code rendered by this page, and make sure the output of <%= ResolveUrl("~/Image/Bluehills.jpg") %> is pointing to your image correctly.

    And btw, is the IMG tag that works you reffed the same one you shown in the code above? because that and the background image name is different.

    Comment

    • jagdeep gupta
      New Member
      • Aug 2010
      • 98

      #3
      Yes the same image was also tried but did not work now i got the tag to work but confused about functionality

      i remove the tilde('~') symbol and image displayed but don't know why it does not work with tilde please help to understand.

      Comment

      • Sudaraka
        New Member
        • Jan 2011
        • 55

        #4
        See if the details in following link helps you wit the ResolveUrl and tilde

        Comment

        Working...