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

GridViewHyperlinkColumn

5 Answers 248 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fadi
Top achievements
Rank 1
Fadi asked on 06 Jun 2016, 12:13 PM

Dear,

is there any capability to change or set the column type dynamically to GridViewHyperlinkColumn after binding?

 

 

Regards,

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 07 Jun 2016, 12:02 PM
Hello Fadi,

Thank you for writing.

You should remove the auto-generated column and add new hyperlink column. Make sure that the FieldName property of the new column is set.

Let me know if I can assist you further.

Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Fadi
Top achievements
Rank 1
answered on 17 Jun 2016, 11:32 AM

After adding the new hyperlink column and set the Fieldname, i am not able to change the font size of the hyperlink column.

I try the cellFormatting event but failed.

I change the font size of the RadGridview but always the hyperlink column is same size!

Need your help.

0
Dimitar
Telerik team
answered on 17 Jun 2016, 11:53 AM
Hi Fadi,

Thank you for writing back.

The theme is explicitly setting the font of the hyperlink. The following snippet shows how you can set the font in the CellFormatting event:
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.ColumnIndex == 0)
    {
        ((GridHyperlinkCellElement)e.CellElement).ContentElement.Font = f;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
    }
}

I hope this will be useful. 

Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Fadi
Top achievements
Rank 1
answered on 17 Jun 2016, 01:57 PM
Ok great but the Underline of the hyperlink content is removed.
0
Dimitar
Telerik team
answered on 20 Jun 2016, 05:59 AM
Hi Fadi,

Thank you for writing back.

You need to specify the font style when creating it:
Font font = new Font("Consolas", 9,FontStyle.Underline);

private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if (e.CellElement.ColumnIndex == 0)
    {
        ((GridHyperlinkCellElement)e.CellElement).ContentElement.Font = font;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
    }
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
GridView
Asked by
Fadi
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Fadi
Top achievements
Rank 1
Share this question
or