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

Convert radGridView column or cell after binding to a Hyperlink?

1 Answer 221 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 13 May 2019, 02:53 AM

Convert radGridView column after binding to a Hyperlink?

 

How can I do this?  When I converted to a radGridView the same type conversion gave errors on compile.

 

With DataGridView control I was able to access a cell and change it to a hyperlink

using very similar code to this:

 

01.void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
02.{
03.    foreach (DataGridViewRow r in dataGridView1.Rows)
04.    {
05.        if (System.Uri.IsWellFormedUriString(r.Cells["Contact"].Value.ToString(), UriKind.Absolute))
06.        {
07.            r.Cells["Contact"] = new DataGridViewLinkCell();
08.            // Note that if I want a different link colour for example it must go here
09.            DataGridViewLinkCell c = r.Cells["Contact"] as DataGridViewLinkCell;
10.            c.LinkColor = Color.Green;
11.        }
12.    }
13.}

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 13 May 2019, 11:14 AM
Hi Roger,

You can use a GridViewHyperlinkColumn. The column is not automatically added so you need to manually add it and specify the FieldName.

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Roger
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or