This is a migrated thread and some comments may be shown as answers.

[Solved] GridViewHyperlinkColumn or not

3 Answers 181 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eric Schoenholzer
Top achievements
Rank 2
Eric Schoenholzer asked on 03 Feb 2010, 11:48 PM
Hi,

I'm using the GridViewHyperlink Column to show a link, DataMemberBinding and ContentBinding bound to two properties.
Is there a way to enable or disable the link depending of a property?
For ex. if the URL property is empty, show no link, else show the link.

2. question:
Is there a way to link to local file uri?  ex. file:///c:/WINDOWS/clock.avi ?

Thanks
Eric 

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 04 Feb 2010, 09:11 AM
Hi EricSch,

On your first question :
Yes  there is a way - you can set the CellTemplate of the Hyperlink column and within the template bind the visibility of the hyperlink to the value of your business object. For this you will  need a ValueConverter to convert from the type of your property to Visibility .
You may also need to implement the INotifyPropertyChanged interface , so that RadGridView could sense changes of your property and automatically update the UI.

If you find difficulties implementing this , just paste me the implementation of your business object and let me know which property should control the visibility of the link. I will gladly prepare a sample for you .

On question 2:

Unfortunately versions of Silverlight lower than 4 can not gain access to any local resource except the isolated storage.

Kind regards,
Pavel Pavlov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Eric Schoenholzer
Top achievements
Rank 2
answered on 04 Feb 2010, 01:33 PM
Hi, thanks for answering.

When I set Visibility to false, will I still see the text?
I don't want to hide all the text.

For exp. my object has two properties: Name and ImdbUrl.
If ImdbUrl contains a url (not empty), show as link text the Name-Value and link it to the ImdbUrl-Value.
If ImdbUrl is empty, show only the Name-Value (without an active hyperlink).

Thanks
Eric

0
Pavel Pavlov
Telerik team
answered on 08 Feb 2010, 03:20 PM
Hi Eric,

Unfortunately for such a specific scenario RadGridView has no internal support.
So you will have to make a small user control to handle the logic : if there is url - show link , else , show label.  Placing your own user control in the cell is easy - just use the CellTemplate property of the column.

In case you find troubles implementing this , just let me know.

Regards,
Pavel Pavlov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
GridView
Asked by
Eric Schoenholzer
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Eric Schoenholzer
Top achievements
Rank 2
Share this question
or