Open hyperlink url from datagridview column C#

Total Post:149

Points:1043

C# 
C#
 6805  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. 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.

      Modified On Mar-29-2018 06:12:11 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.