Version

Adding a Hyperlink to a Cell in WinGrid

The FormattedLinkEditor class gives you the ability to add hyperlinks to any Ultimate UI for Windows Forms control which uses embeddable editors. FormattedLinkEditor derives from the embeddable editors base class in order to give Ultimate UI for Windows Forms controls this functionality. This topic will guide you through the task of setting up the WinGrid™ control using the WinDataSource™ component to store unformatted text. You will then use the WinFormattedLinkLabel™ control to format this text and display hyperlinks.

  1. Set up WinDataSource and WinGrid.

    1. Drag the UltraDataSource component onto the form. The ultraDataSource1 component appears in the component tray

    2. Drag the UltraGrid control from the toolbox onto the form.

    3. In the Properties window, find the DataSource property and set it to ultraDataSource1.

  1. Set up the data source.

    1. Right-click the ultraDataSource1 component in the component tray and select "UltraDataSource Designer." The UltraDataSource Designer appears.

    2. Under DataColumns, click the "Add a new column" button

    3. Click Apply.

    4. Click Data Entry from the tree on the left.

    5. In the first cell, enter "<a href="www.infragistics.com">Infragistics</a>" into the cell and then press Enter.

    6. In the second cell, enter "<a href="www.microsoft.com">Microsoft</a>" into the cell and then press Enter.

    7. In the third cell, enter <a href="www.google.com">Google</a>" into the cell and then press Enter.

    8. Click Apply, and then OK.

  1. Set up the WinFormattedLinkLabel control and set it as the column’s EditorControl.

    1. Drag the UltraFormattedLinkLabel control onto the form.

    2. Right-click on the grid and select "UltraGrid Designer…"

    3. Under "Band and Column Settings", expand Band [0].

    4. Under "Band [0]", click Columns.

    5. Find the EditorComponent property in the Properties window and set it to ultraFormattedLinkLabel1.

    6. Click Apply, and then OK.

  1. Run the application.

Click on any of the links and a Microsoft® Internet Explorer window will open with the appropriate link.

Note
Note

The WinFormattedLinkLabel control will always use the .NET Process class to open a new link. Therefore, it is up to the system, not WinFormattedLinkLabel, to decide how to handle the opened link.