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

How to set GridView row header column width / text alignment

1 Answer 1268 Views
GridView
This is a migrated thread and some comments may be shown as answers.
eSimSE
Top achievements
Rank 1
eSimSE asked on 28 Aug 2012, 01:41 PM
Hello,

First, I am starting from this very helpful article: thank you for the recursive solution. VERY helpful: row-header-text

Next, maybe it was asked, how do we set the width of the row header? And/or text horizontal alignment? And/or position of the editor icon(s)?

Because while we're getting the row indexing we're looking for, the icons paint over top of that, or vice versa.

Thank you...

Best regards.

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 30 Aug 2012, 12:13 PM
Hi Michael,

You can change the width of the row header column by setting RowHeaderColumnWidth property of GridTableElement:
this.radGridView1.TableElement.RowHeaderColumnWidth = 50;

Then you should use the ViewCellFormatting event to change text-image relation:
void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    GridRowHeaderCellElement cell = e.CellElement as GridRowHeaderCellElement;
    if (cell != null)
    {
        cell.TextImageRelation = TextImageRelation.ImageBeforeText;
        cell.Text = "1";
    }
}

I hope this helps.

Greetings,

Svett
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
eSimSE
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or