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

[Solved] Change Appearence of Hyperlink

3 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike Kacos
Top achievements
Rank 1
Mike Kacos asked on 02 Sep 2009, 07:36 PM

Hi,

    I have a GridHyperLinkColumn which I set dynamically in the ItemDataBound event.  In some cases (based on a boolean value in the underlying business object) the Hyperlinks navigateURL will not be set at all.  On these cases I'd like the value to not appear as a hyperlink (not in blue or underlined).  Do I need to change to a different column type?  What would the code look like for that?

Thanks,
-Mike

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 03 Sep 2009, 10:04 AM
Hello Mike,

I suggest you to use the RadGrid ItemDataBound event to modify the hyperlink's appearance, e.g. set some custom CSS class or inline styles.

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

The hyperlink is the first control in the respective table cell accessible via

(e.Item as GridDataItem)["MyColumnUniqueName"].Controls[0]

in ItemDataBound.

Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Kacos
Top achievements
Rank 1
answered on 03 Sep 2009, 12:51 PM
Thanks Dimo, but I think I'm missing something.  There doesn't appear to be a CSS or Style attribute of the Controls collection for me to set.  Can you provide an actual example of setting the style in ItemDataBound?

Thanks,
-Mike
0
Mike Kacos
Top achievements
Rank 1
answered on 03 Sep 2009, 01:06 PM
Nevermind, I found a different solution, based on your post.  I cleared out the Controls collection, then just added a standard Label. 

Thanks for your help!

-Mike
Tags
Grid
Asked by
Mike Kacos
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Mike Kacos
Top achievements
Rank 1
Share this question
or