Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

issue for background-image in a td tag

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adam Right - 17 Feb 2008 14:13 GMT
Hi All,

I have some HTML  tags in a .ascx control
If i use style="background-image" in a <td> tag on that ascx control, i can
see the jpg file on design-time but it does not work in run-time for
master-pages..

But if i use same picture in a asp:ImageButton control like
<asp:ImageButton ID="Button1" runat="server"
ImageUrl="~/Images/design/search.jpg" OnClick="Button1_Click"/>

it works fine.

...
The  td tag on .ascx file is :
<td
style="width:202;height:34;background-image:url(~/Images/design/search.jpg)"

Any idea how to handle this problem?

Thanks,

Adam
Eliyahu Goldin - 17 Feb 2008 15:39 GMT
~ is understoos only on server side. Add runat="server" to the td and the
server side should resolve the url correctly.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Hi All,
>
[quoted text clipped - 19 lines]
>
> Adam
Jesse Houwing - 17 Feb 2008 21:41 GMT
Hello Eliyahu,

> ~ is understoos only on server side. Add runat="server" to the td and
> the server side should resolve the url correctly.

Is that true for a style tag as well? I never knew that, it would be a pretty
handy feature...

Jesse

>> Hi All,
>>
[quoted text clipped - 20 lines]
>>
>> Adam

--
Jesse Houwing
jesse.houwing at sogeti.n
Eliyahu Goldin - 18 Feb 2008 09:06 GMT
You can check it easily. Use a path with the "~" syntax, get the page
rendered in your browser and view the html source. All "~" references should
be replaced with something like ../.. etc. If you see "~", then the path
isn't going to work.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Hello Eliyahu,
>
[quoted text clipped - 34 lines]
> Jesse Houwing
> jesse.houwing at sogeti.nl
Adam Right - 18 Feb 2008 10:20 GMT

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.