Old GridViewHyperLinkColumn TextAlignment bug resurfaces

3 posts, 1 answers
  1. Patrick
    Patrick avatar
    2 posts
    Member since:
    Aug 2013

    Posted 06 Aug 2013 Link to this post

    I'm currently evaluating Telerik Winforms controls for a project (specifically, the GridView).  I downloaded the installer yesterday so I believe I'm using the most recent version (RadControlsForWinFormsSetup_2013_2_724).  Everything is working fine except the TextAlignment on GridViewHyperlinkColumns.  I found an old forum post about this issue:


    I tried the workaround posted but it didn't work.  After some research, I found this page:


    Which states the bug was fixed back in the "RadControls for WinForms 2012.3 1017 Oct 17, 2012" release.  However, I'm seeing the bug as described in the old forum post.  Here's a sample of the data bound to a text box and then bound to a hyper-link column, both with TextAlignment set to MiddleLeft:


    Is this a regression issue?  Is there a work-around for this?  The workaround posted in the original thread no longer works.

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4170 posts

    Posted 09 Aug 2013 Link to this post

    Hello Patrick,

    Thank you for contacting Telerik Support.

    I confirm that the issue was not fully resolved. TextAlignment property affects only the ContentElement.Alignment property of the GridHyperlinkCellElement while it should also set the ContentElement.TextAlignment property. I have reopened the PITS-issue which and we will address it accordingly. I have also updated the Telerik points to your account for the cooperation. Until then, the appropriate workaround is:
    private void Form1_Load(object sender, EventArgs e)
                // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
                DataColumn colContactName = nwindDataSet.Customers.Columns["ContactName"];
                DataColumn colAddress = nwindDataSet.Customers.Columns["Address"];
                this.radGridView1.Columns.Add(new GridViewHyperlinkColumn(colAddress.ColumnName + " Link"));
                this.radGridView1.Columns["Address"].TextAlignment = ContentAlignment.MiddleRight;
                this.radGridView1.Columns["Address Link"].TextAlignment = ContentAlignment.MiddleRight;
                foreach (DataRow row in nwindDataSet.Customers.Rows)
                    this.radGridView1.Rows.Add(row.ItemArray[2], row.ItemArray[4], row.ItemArray[4]);
            private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
                GridHyperlinkCellElement cell = e.CellElement as GridHyperlinkCellElement;
                if (cell != null)
                    cell.ContentElement.TextAlignment = ContentAlignment.MiddleRight;

    I hope this information helps. Should you have further questions, I would be glad to help.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Patrick
    Patrick avatar
    2 posts
    Member since:
    Aug 2013

    Posted 09 Aug 2013 Link to this post

    Thanks for the workaround Desislava!

Back to Top