Convert radGridView column or cell after binding to a Hyperlink?

2 posts, 0 answers
  1. Roger
    Roger avatar
    1 posts
    Member since:
    Feb 2014

    Posted 12 May 2019 Link to this post

    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.}
  2. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 13 May 2019 Link to this post

    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.
Back to Top