Please refer to:
- Steps To Add Combobox Inside Datagridview Window Form
- Selected Values Of Combobox Inside DatagridView

Step 2: Create data table in the code and bind the data table to DataGridView datasource in the form load event.
Create data table in code
- /// <summary>
- /// Get datatable of description.
- /// </summary>
- /// <returns></returns>
- private DataTable GetDescriptionTable()
- {
- DataTable l_dtDescription = new DataTable();
- l_dtDescription.Columns.Add("Description", typeof(string));
- l_dtDescription.Columns.Add("Type", typeof(string));
- l_dtDescription.Columns.Add("Email", typeof(string));
- l_dtDescription.Columns.Add("WWW", typeof(string));
- l_dtDescription.Rows.Add("Lunch", "Expense", "[email protected]", "http://www.sagarratna.in/");
- l_dtDescription.Rows.Add("Dinner", "Expense", "[email protected]", "http://www.mayfairhotels.com/");
- l_dtDescription.Rows.Add("Breakfast", "Expense", "[email protected]", "http://www.haldirams.com/");
- l_dtDescription.Rows.Add("Designing", "Service", "[email protected]", "http://www.adjaye.com/");
- l_dtDescription.Rows.Add("Drawing", "Service", "[email protected]", "http://www.painterartist.com/fr");
- l_dtDescription.Rows.Add("Paper", "Material", "[email protected]", "https://riflepaperco.com/");
- l_dtDescription.Rows.Add("DrawingBoard", "Material", "[email protected]", "http://www.drawingboard.com/");
- return l_dtDescription;
- }
- private void Form3_Load(object sender, EventArgs e)
- {
- dgv.DataSource = GetDescriptionTable();
- }

Step 4: For setting an Email and WWW columns as hyperlink, we need to set the style of a grid column.
The function to get the style for hyperlink is given below:
- /// <summary>
- /// This function is use to get hyperlink style .
- /// </summary>
- /// <returns></returns>
- private DataGridViewCellStyle GetHyperLinkStyleForGridCell()
- {
- // Set the Font and Uderline into the Content of the grid cell .
- {
- DataGridViewCellStyle l_objDGVCS = new DataGridViewCellStyle();
- System.Drawing.Font l_objFont = new System.Drawing.Font(FontFamily.GenericSansSerif, 8, FontStyle.Underline);
- l_objDGVCS.Font = l_objFont;
- l_objDGVCS.ForeColor = Color.Blue;
- return l_objDGVCS;
- }
- }
- private void SetHyperLinkOnGrid()
- {
- if (dgv.Columns.Contains("Email"))
- {
- dgv.Columns["Email"].DefaultCellStyle = GetHyperLinkStyleForGridCell();
- }
- if (dgv.Columns.Contains("WWW"))
- {
- dgv.Columns["WWW"].DefaultCellStyle = GetHyperLinkStyleForGridCell();
- }
- }
- private void dgv_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
- {
- SetHyperLinkOnGrid();
- }

Step 7: Enable the hyperlink, which means when the user clicks over “WWW” content, open the link of the Web Browser and when the user clicks over “Email” content, open link in an Email.
- private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- if (dgv.Columns[dgv.CurrentCell.ColumnIndex].HeaderText.Contains("WWW"))
- {
- if ( ! String.IsNullOrWhiteSpace (dgv.CurrentCell.EditedFormattedValue.ToString ()))
- {
- System.Diagnostics.Process.Start("http://" + dgv.CurrentCell.EditedFormattedValue);
- }
- }
- if (dgv.Columns[dgv.CurrentCell.ColumnIndex].HeaderText.Contains("Email"))
- {
- if (!String.IsNullOrWhiteSpace(dgv.CurrentCell.EditedFormattedValue.ToString()))
- {
- System.Diagnostics.Process.Start("mailto://" + dgv.CurrentCell.EditedFormattedValue);
- }
- }
- }

jyothi kPosted Oct 1, 2018, 4:06 AM
Thank You but i have one doubt how to change the link name i.e.,if the link is www.google.com it should be look like google when i click on google website should be open..