Redirect hyperlink column

J

jib

How do I redirect a hyperlink column's URL when the URL doesn't exist? Is
it possible to set a default URL for the Hyperlink button?

Thanks,

Jib
 
H

Hermit Dave

Hyperlink has a property called NavigateURL... assign the URL you need to go
to there.....
you also have a target property where you can set the target on a particular
frame or a new window etc...

hth
 
J

jib

Hermit Dave said:
Hyperlink has a property called NavigateURL... assign the URL you need to go
to there.....
you also have a target property where you can set the target on a particular
frame or a new window etc...

hth

Hi Dave,

The object I referred to is not a 'Hyperlink' but a 'Hyperlink column' (as
part of a DataGrid). Assigning the URL, URL field, and URL format string is
quite simple - no problem there. However, what I haven't figured out is how
I customize the response in case the URL points to a non-existent page.

For example, I have a DataGrid that holds information on a large series of
documents. The first column is a hyperlink column that points to the actual
document. The URL is set by the DataGrid automatically based on the URL
field and URL format string. Works perfectly. However, in some cases the
document does not exist and clicking on the hyperlink column button is
followed by a "Page Cannot be Displayed" response. I want to be able to
customize _that_ response page so I can supply a more intelligent error
message.

I guess my original question was somewhat short ... :)

Jib
 
D

Dan Brussee

Sounds like a custom 404 page is what you are looking for. When a page
is not found, HTTP reports error 404 (page not found - go figure). You
can customize that response page any way you want. It's not any part
of ASP.NET, of course though.
 
H

Hermit Dave

if you have the access to the physical files that the formed URL point to
then i would say that do a check on whether they exist or not...
look into System.IO...

File.Exists(path) is your long lost mate...
 
J

jib

Hermit Dave said:
if you have the access to the physical files that the formed URL point to
then i would say that do a check on whether they exist or not...
look into System.IO...

File.Exists(path) is your long lost mate...
Hmm, I was afraid that would be the answer. I'll give it a shot - thanks for
helping me think.

Jib
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top