GrapeCity MultiRow Windows Forms Documentation
Open Link in Associated Browser (LinkLabelCell)

In order to open the URL in an associated browser once the user clicks on the link label cell, you can use the GcMultiRow.CellContentClick event.

Using Code

This example uses the CellContentClick event.

[VB]

Imports System.Diagnostics
Imports GrapeCity.Win.MultiRow

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim linkLabelCell1 As New LinkLabelCell()
    linkLabelCell1.Name = "linkLabelCell1"
    linkLabelCell1.Value = "http://www.grapecity.com"
    GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {linkLabelCell1})
End Sub

Private Sub GcMultiRow1_CellContentClick(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellEventArgs) Handles GcMultiRow1.CellContentClick
    Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow)
    Dim currentCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)

    If TypeOf currentCell Is LabelCell Then
        If e.CellName = "linkLabelCell1" Then
            If currentCell.Enabled = True Then
                Dim command As String = currentCell.Value.ToString()
                Process.Start(command)
            End If
        End If
    End If
End Sub

[CS]

using System.Diagnostics;
using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
 {
     LinkLabelCell linkLabelCell1 = new LinkLabelCell();
     linkLabelCell1.Name = "linkLabelCell1";
     linkLabelCell1.Value = "http://www.grapecity.com";
     gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { linkLabelCell1 });
}

private void gcMultiRow1_CellContentClick(object sender, CellEventArgs e)
{
    GcMultiRow gcMultiRow = sender as GcMultiRow;
    Cell currentCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
    
    if (currentCell is LinkLabelCell)
    {
        if (e.CellName == "linkLabelCell1")
        {
            if (currentCell.Enabled == true)
            {
                string command = currentCell.Value.ToString();
                Process.Start(command);
            }
        }
    }
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options