OPEN HYPERLINK URL FROM DATAGRIDVIEW COLUMN C#

Royce Roy

Total Post:149

Points:1043
Posted by  Royce Roy
C# 
C#
 5864  View(s)
Ratings:
Rate this:
Hi Guys

I have a link column in my datagridview with some URL string from example "http://google.com". I want to open this URL on website. How it is possible?

Thanks.
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: open hyperlink url from datagridview column C#

    Hi Royce Roy,

    Try this code within CellContentClick event of DataGridView

     private void dgvControl_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
                string sUrl = dgvControl.Rows[e.RowIndex].Cells[2].Value.ToString();
                ProcessStartInfo sInfo = new ProcessStartInfo(sUrl);
                Process.Start(sInfo);
            }

    Note: Changed column index (Rows[e.RowIndex].Cells[2]) according your link column of datagridview.
    I hope it resolve your problem.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!