GridViewHyperlinkColumn

6 posts, 0 answers
  1. Fadi
    Fadi avatar
    10 posts
    Member since:
    Jan 2015

    Posted 06 Jun Link to this post

    Dear,

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

     

     

    Regards,

  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 07 Jun Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Fadi
    Fadi avatar
    10 posts
    Member since:
    Jan 2015

    Posted 17 Jun in reply to Dimitar Link to this post

    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.

  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 17 Jun Link to this post

    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.
  6. Fadi
    Fadi avatar
    10 posts
    Member since:
    Jan 2015

    Posted 17 Jun in reply to Dimitar Link to this post

    Ok great but the Underline of the hyperlink content is removed.
  7. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 20 Jun Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready