473,750 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting virtual path on Table controls

Hi,

I have some simple html:

<table>
<tr>
<td background="~/images/category_backgr ound.jpg" runat=server></td>
</tr>
</table>

If I hardcode the path for the background, all is fine, but using the tilde
and runat server doesnt work. I need to work with relative paths, because
the HTML is in a web usercontrol shown on pages at different levels.

Any advice?

Nick.
Nov 19 '05 #1
3 1542

Try to use the following expression:

<table>
<tr>
<td
background='<%= ResolveUrl("../images/category_backgr ound.jpg")%>'></td>
</tr>
</table>

So, you can use relative paths. But don't forget to use ' instead of " in
background='' propert, overwise ASP.NET shows an syntax error.

Gaidar

"Nick" <ni**@nick.nick > wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have some simple html:

<table>
<tr>
<td background="~/images/category_backgr ound.jpg"
runat=server></td>
</tr>
</table>

If I hardcode the path for the background, all is fine, but using the
tilde and runat server doesnt work. I need to work with relative paths,
because the HTML is in a web usercontrol shown on pages at different
levels.

Any advice?

Nick.

Nov 19 '05 #2
Gaidar,

Thanks for replying. I have tried your advice, which seems sound, but when
I view the HTML in the browser, I see:

<td
background="<%= ResolveUrl(&quo t;../images/promos/simplePromo_sha de_leftside.jpg &quot;);%>">
</td>

The C# isnt being compiled and executed....any thoughts?

Thanks

Nick.

"gaidar" <ga****@vbstree ts.ru> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..

Try to use the following expression:

<table>
<tr>
<td
background='<%= ResolveUrl("../images/category_backgr ound.jpg")%>'></td>
</tr>
</table>

So, you can use relative paths. But don't forget to use ' instead of " in
background='' propert, overwise ASP.NET shows an syntax error.

Gaidar

"Nick" <ni**@nick.nick > wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have some simple html:

<table>
<tr>
<td background="~/images/category_backgr ound.jpg"
runat=server></td>
</tr>
</table>

If I hardcode the path for the background, all is fine, but using the
tilde and runat server doesnt work. I need to work with relative paths,
because the HTML is in a web usercontrol shown on pages at different
levels.

Any advice?

Nick.


Nov 19 '05 #3
I got it working Gaidar.

One further question is how performant is it to keep using ResolveUrl for
all urls on the page? Is it not a problem because the page gets compiled
anyway? I have put a script block at the top of my control, and access the
base image URL using ResolveUrl. I then access this field in my code:

<table>
<tr>
<td
background='<%= Path + "categoryMenu_b ackground.jpg"% >'></td>
</tr>
</table>

Thanks

Nick.

"Nick" <ni**@nick.nick > wrote in message
news:e4******** ******@TK2MSFTN GP09.phx.gbl...
Gaidar,

Thanks for replying. I have tried your advice, which seems sound, but
when I view the HTML in the browser, I see:

<td
background="<%= ResolveUrl(&quo t;../images/promos/simplePromo_sha de_leftside.jpg &quot;);%>">
</td>

The C# isnt being compiled and executed....any thoughts?

Thanks

Nick.

"gaidar" <ga****@vbstree ts.ru> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..

Try to use the following expression:

<table>
<tr>
<td
background='<%= ResolveUrl("../images/category_backgr ound.jpg")%>'></td>
</tr>
</table>

So, you can use relative paths. But don't forget to use ' instead of " in
background='' propert, overwise ASP.NET shows an syntax error.

Gaidar

"Nick" <ni**@nick.nick > wrote in message
news:uS******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have some simple html:

<table>
<tr>
<td background="~/images/category_backgr ound.jpg"
runat=server></td>
</tr>
</table>

If I hardcode the path for the background, all is fine, but using the
tilde and runat server doesnt work. I need to work with relative paths,
because the HTML is in a web usercontrol shown on pages at different
levels.

Any advice?

Nick.



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4231
by: Jeffry van de Vuurst | last post by:
Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of you has some ideas about this. I'm using the NetAdvantage component suite from Infragistics for my web applications. When installing they create several virtual
8
641
by: Alex | last post by:
Hi, I have noticed that in an aspx page <!--#include virtual="Home.htm"--> acts the same as <!--#include File="Home.htm"--> when I am NOT in the root diectory of the site (I am aware that they will reference the same file if in the root dir)
12
1786
by: Brian Henry | last post by:
I made a header control in asp.net and it references images in the /images/ folder in the virtural path's root folder... How can I get the header control to show the images at any level of the web site? i got the controls to load using the ~/tempates/ctrlHeader thing in the references section of the page that uses them, but I need that same idea in the actual control so it knows to refrence the image folder no mater where the page its doing...
2
1360
by: Ralph | last post by:
Hi, I've done a bit of reading on setting up an Isolated .NET environment for each of my developers. We all run Windows XP Pro, IIS and have local instances of SQL Server for development. I have a few problems that I am trying to work around. 1) All our sites are created using virtual paths. If I am to adopt the isolated model and develop on each developers machine, when you create
3
1950
by: Patrick | last post by:
I am dynamically creating TextArea and drop-down lists in ASP.NET using something like HtmlTextArea eachTextArea = new HtmlTextArea(); I tried to set the "name" of these TextAreas, etc. (e.g. <textarea name="NameOfTextArea" rows="5" cols="60">some text area</textarea>), as I want to then dynamically read back the controls' values Setting the ID attributes doesn't work, nor does the following:...
19
10235
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
3
1523
by: Dhruba Bandopadhyay | last post by:
In classic ASP I could write: <!-- #INCLUDE VIRTUAL="Kevin\General\ServiceClass.asp" --> and it would "include" that ASP file into the current ASP file. My web application folder was not stored in C:\Inetpub\wwwroot\ but somewhere else. But the VIRTUAL command let IIS locate files by the IIS virtual folder. Now in ASP.NET this does not work. It complains saying:
1
6504
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
4
3338
by: tshad | last post by:
I have a site www.stf.com and a site www.stfstage.com (where I do all my testing). The problem is that www.stfstage.com is only internal and I need to get access from the outside (without creating a new domain). I tried to create a Virtual directory inside my stf site so that I would access it like: www.stf.com/stage/. I run as www.stfstage.com fine and have for a long time.
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.