Home > DeveloperSection > Forums > Open hyperlink url from datagridview column C#
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    January-07-2013 7:58 AM

 C# C# 
Ratings:


 1 Reply(s)
 4822  View(s)
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.


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    January-07-2013 8:06 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick