This is a migrated thread and some comments may be shown as answers.

Hyperlink Column in Windows RadGridView

7 Answers 636 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ganeshram
Top achievements
Rank 1
Ganeshram asked on 11 Feb 2008, 07:31 AM
Hi,
I have two questions

Hyperlink Like Column:
    Basically I have to display a list of columns where some columns will be used as hyperlink to take it to their details.How to get a column as hyperlink in window gridview which will take it to new form.

All I want to be able to add a column like the normal data grid view control where the user can click the text which appears like a hyperlink and have some action occur.
 
Change the Font:
I have a workaround solution if cannot create hyperlink like column.Change the color of the cellelement to Blue and underline.And on cell element click we can take it to new form.How to change the font of the cell element in runtime.I can see font.underline is readonly.?

Please help

7 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 11 Feb 2008, 09:18 AM
Hi Ganeshram,

Thank you for writing us.

Currently, RadGridView does not support a hyperlink column. We will consider implementing this functionality in our upcoming Q1 2008 release.

The following code demonstrates how to change the font and the color of a column to represent a hyperlink:

Font font;  
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);  
this.radGridView1.CellClick += new GridViewCellEventHandler(radGridView1_CellClick);  
this.radGridView1.DataSource = table;  
this.radGridView1.Columns["Name"].ReadOnly = true;  
  
void radGridView1_CellClick(object sender, GridViewCellEventArgs e)  
{  
    if (e.ColumnIndex == 1 && e.RowIndex > 0)  
    {  
        Process.Start("http://www.google.com");  
    }  
}  
  
  
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)  
{  
    if (e.CellElement is GridDataCellElement)  
    {  
        if (((GridViewDataColumn)e.CellElement.ColumnInfo).DataField == "Name")  
        {  
            e.CellElement.Font = font;  
            e.CellElement.ForeColor = Color.Blue;  
        }  
    }  
}  
  

Do not hesitate to write us if you have other questions.

All the best,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kumar
Top achievements
Rank 1
answered on 05 Mar 2010, 04:01 PM
I do not see RadGridView supports hyperlink column yet. Is this being considered. Also as a work around I am trying to change the font to blue and underling the text. Is there a easy way to underline the text? Thanks in advance.
0
Jack
Telerik team
answered on 09 Mar 2010, 08:52 AM
Hello Kumar,

Yes, currently there is no dedicated hyper link column. You should use the code from my previous post. It changes the font color to blue by setting the ForeColor property. To make the font underlined just use the proper definition:

Font font = new Font(SystemFonts.DialogFont, FontStyle.Underline);

I hope this helps.

All the best,

Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
RIZAL
Top achievements
Rank 1
answered on 17 Sep 2015, 08:43 AM

Hi, with the latest release, I think radgridview support to open other form beside goto to website.

Can you show me how?

 

Tq

0
Stefan
Telerik team
answered on 17 Sep 2015, 08:51 AM
Hi,

You can use the HyperlinkOpening event, which is cancelable and open the form that you want.

More information regarding the hyperlink column is available here: http://www.telerik.com/help/winforms/gridview-columns-gridviewhyperlinkcolumn.html.

I hope this helps.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
RIZAL
Top achievements
Rank 1
answered on 17 Sep 2015, 09:14 AM

Hi, sorry not to explain further.

 I tried using HyperlinkOpening and also HyperlinkOpened event but didn't worked.

What I want to do is when user click the hyperlink, it will open the second form.

 The code:

Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

      me.Textbox1.Text = ​Form1.​gridview.CurrentRow.Cells("ID").Value

End Sub

 The problem is it shows the previous selected row index because the hyperlink row only will be selected after Form2 closed.

 

 

 

 

0
Stefan
Telerik team
answered on 18 Sep 2015, 07:37 AM
Hi,

It seems you pasted wrong code snippet. Here is one demonstrating how this can be done:
Private Sub RadGridView1_HyperlinkOpening(sender As Object, e As HyperlinkOpeningEventArgs)
    e.Cancel = True
 
    Dim f As New Form()
    f.Text = e.Column.Name + " " + e.Row.Index
    f.Show()
End Sub

I hope this helps.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Ganeshram
Top achievements
Rank 1
Answers by
Jack
Telerik team
Kumar
Top achievements
Rank 1
RIZAL
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or