Redirect hyperlink column

  • Thread starter Thread starter jib
  • Start date Start date
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
 
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
 
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
 
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.
 
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...
 
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
 
Back
Top