)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a cell that contains the Hypertext link along with different format in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 30, 2011 |
Last Revised Date: December 18, 2019

Hyperlink and text format applied in a grid cell

The RichText cell control in the library allows you to edit the text via a dropdown panel. By assigning the CellType as RichText, you can have a cell with the Hyperlink text and different formats.

C#

//Sets the CellType as RichText
this.gridControl1[2, 2].CellType = GridCellTypeName.RichText;
//The RTF text is having Bold, Italic and Hyperlink 
this.gridControl1[2, 2].Text = @"{\rtf1\ansi\ansicpg1252\deff0\deftab709{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}}" +
    @"{\colortbl ;\red0\green0\blue255;\red0\green0\blue128;}" +
    @"{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\b\f0\fs24 Bold\b0\par" +
    @"\i Italic\i0\par" +
    @"{\field{\*\fldinst{HYPERLINK 'http://www.google.com/' }}{\fldrslt{\cf2\ul www.google.com}}}\cf0\ulnone\f0\fs24\par}";

 

VB

'Sets the CellType as RichText
Me.gridControl1(2, 2).CellType = GridCellTypeName.RichText
' The RTF text is having Bold, Italic and Hyperlink 
Me.gridControl1(2, 2).Text = "{\rtf1\ansi\ansicpg1252\deff0\deftab709{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}}" & "{\colortbl ;\red0\green0\blue255;\red0\green0\blue128;}" & "{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\b\f0\fs24 Bold\b0\par" & "\i Italic\i0\par" & "{\field{\*\fldinst{HYPERLINK 'http://www.google.com/' }}{\fldrslt{\cf2\ul www.google.com}}}\cf0\ulnone\f0\fs24\par}"

 

The following screenshot displays the Cell that contains the Hyperlink and different formatted texts.

Hyperlink cell text in gridcontrol

Samples:

C#: HypertextCell-C#.zip

VB: HypertextCell-VB.zip

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon