6

I have a RadGrid where a column in the grid holds a URL. When a put a value in the column I can see the URL but the URL is not clickable (to go to the URL). How can I make the URL clickable?

Here is a rough example of what I'm doing now:

DataTable table = new DataTable();
DataRow row = table.Rows[0];
row["URL"] = "http://www.google.com";
grid.DataSource = table;

In addition I'd really like to show specific text instead of the URL. Something similar to <a href="http://www.google.com">Link</a> in HTML. Is there anyway to do this?

brainimus
  • 10,586
  • 12
  • 42
  • 64

3 Answers3

8

Have you tried the GridHyperLinkColumn? Below is a detailed example.

<telerik:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Search Google for '{0}'" DataNavigateUrlFields="CompanyName" UniqueName="CompanyName" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&amp;q={0}&amp;btnG=Google+Search" HeaderText="HyperLink<br/>Column" DataTextField="CompanyName"></telerik:GridHyperLinkColumn>

You can also view the demosite to see how it works. http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx

Michael Grassman
  • 1,935
  • 13
  • 21
  • Thanks Michael, Is it possible to use javascript onclick event as like:
  • Ajax, Advanced Functions
  • – Sensa May 15 '12 at 14:49
  • I like to have this on click in – Sensa May 15 '12 at 14:49