what's wrong with my path (Full Version)

All Forums >> [Web Development] >> Expression Web Help



Message


swoosh -> what's wrong with my path (5/25/2007 12:44:47)

have a gridview results page in this directory:

ROOT>>DOWNTOWN>>AMBRIDGE>>BUSINESS_DEVELOPMENT


All works fine........then a link on this page to view the Details Page also in the same directory works fine.


If I move the Details Page to the root.........it doesn't work, but it also doesn't work when I change the parameter link to look at the details page on the root.

For example:

When both were in the same directory, all I had to supply was this "details.aspx?Unit_ID={0}

then I moved the details page to the root and changed the syntax to various paths such as this: ../../../details.aspx?Unit_ID=[0}

The above path has been tried with various combiniatons BUT IT DOESN'T WORK, OBVIOUSLY MY PATH IS WRONG. DOES ANYONE KNOW WHAT IT SHOULD BE? am I way off the radar here?[8|]








WantToLearn -> RE: what's wrong with my path (5/26/2007 20:48:35)

I've never had success using "../../" with ASP.NET controls and the cool thing about .net is that you don't have to. You can use the "Tilde" (~) solution. Check out these articles for details.

http://www.aspnetpro.com/newsletterarticle/2003/11/asp200311kd_l/asp200311kd_l.asp

http://authors.aspalliance.com/remas/ASP.NET/GreatFeatures/Tilde/






swoosh -> RE: what's wrong with my path (5/28/2007 22:21:03)

Thanks a bundle WTL.....it works great, and so much easier too.

Now for another path question if anyone has any suggestions:

On my details page which is now working thanks to WTL. I have a picture to be displayed. When I edit the data bindings for this field I use a custom expression:

It automatically reads EVAL("Picture") where picture is the name of the field in my database. This is obviously saying to take the value of this field. which the value is strictly the image name for example: swoosh.jpg

However the pictures are in a folder named PHOTOS which is a subdirectory of the root........so I have tried the following:

photos/& EVAL("Picture")
../photos & EVAL("Picture")
~/photos & EVAL("Pictue")


I have used the above paths with quotes as well but nothing seems to work. If I have the photos in the same directory as the details page then it works or if I have the picture value have Photos/swoosh.jpg it works.....but I certainly do not want all the photos to be on the root nor do I want to have to add "PHOTOS" to the value of each record which is why I want to reference a Photos folder

Here is the following Error Message I am receiving trying to use one of my previous attempts:

Line 124:			<br />
Line 125:			Picture:
Line 126:			<asp:Image runat="server" id="Image1" ImageUrl='<%# "~/photos/" & Eval("Picture") %>' />
Line 127:			<br />
Line 128:		</ItemTemplate>


Can anyone see where I am screwing this up?




Tailslide -> RE: what's wrong with my path (5/29/2007 3:11:39)

I don't use ASP - but would /photos/& EVAL("Picture") work?




WantToLearn -> RE: what's wrong with my path (5/29/2007 10:00:09)

Give this a try:

Eval("Picture", "~/photos/{0}")




swoosh -> RE: what's wrong with my path (5/31/2007 10:38:53)

quote:

Eval("Picture", "~/photos/{0}")


It worked like a charm WTL!!! thanks AGAIN for your assistance.

TAIL: Didn't get a chance to try yours, but I will and let this thread know if it worked, I appreciate your time and input.




Tailslide -> RE: what's wrong with my path (5/31/2007 11:41:35)

My suggestion probably wouldn't work as it was a total blind guess and I know nothing about ASP!!




WantToLearn -> RE: what's wrong with my path (5/31/2007 15:56:04)


quote:

ORIGINAL: WantToLearn

Give this a try:

Eval("Picture", "~/photos/{0}")



Here's an attempt to explain why the above code works. The Eval statement can take a second parameter that will format the output and can be used to combine the value with other text. So, in the example above, Eval replaces the {0} with the value in "picture".

Why {0}? It is the same used in ASP.NET formatting functions which you can read more about here.

There are several common, built-in formats you can use. For example, if you want to format the field as currency, you can use the built-in currency format "{0:C}" like so:

<%# Eval("Price", "{0:C}") %>

You can then combine the currency formatted field with other text like so:

<%# Eval("Price", "Special Offer {0:C} for Today Only!") %>


Below are some links for futher reading.

MSDN Formatting Overview

MSDN Composite Formatting

Simplified and Extended Data Binding Syntax in ASP.NET 2.0











Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.054688E-02