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

Radgrid GridBoundColumn Not Aligning When Using DataFormatString

4 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 05 Oct 2012, 11:33 AM
Hello,

Thank you in advance for any and all assistance.

I have a gridbound column that is ignoring alignment settings.

<telerik:GridBoundColumn DataField="TOTAL_AMOUNT" Aggregate="Sum"
    ItemStyle-Font-Size="XX-Small" HeaderStyle-Font-Size="XX-Small" FooterStyle-Font-Size="XX-Small" ItemStyle-Wrap="false" FooterStyle-Wrap="false" HeaderStyle-Wrap="false"
    ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
    DataFormatString="{0:$###,##0.00}" DataType="System.Double"
    HeaderText="RQMT AMOUNT" SortExpression="Number" UniqueName="AMOUNT"
    FilterControlAltText="Filter AMOUNT column">
    <ItemStyle HorizontalAlign="right" />
</telerik:GridBoundColumn>

When I remove the attribute DataFormatString="{0:$###,##0.00}", the column then aligns correctly to the right.  I've also tried taking the CSS style approach, with no results.  Is there some tip/trick that I'm missing?

Thanks again for any assistance!

4 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 05 Oct 2012, 02:06 PM
Think I'm on to something...

I'm using TableLayout = "Fixed" in the MasterTableView and am trying to cram more data into the given space than it can handle, so the control tries to compensate by overlapping columns.  This appears to be where the alignment is lost.

I arrived at this opinion by setting visible=false to the 12 or so columns to the right of the offending mis-aligned column, which then rendered it correctly.  After changing them to visible=true one by one, the 10th or so column threw my original column out of alignment.

Is there a setting which might help with this?
0
Tsvetina
Telerik team
answered on 10 Oct 2012, 08:11 AM
Hello Patrick,

Why not enable horizontal scrolling for the grid (ClientSettings.Scrolling.AllowScroll=true). In such case, you can specify width for your columns using the HeaderStyle-Width property of each column and get all them to display as required.

Regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Patrick
Top achievements
Rank 1
answered on 10 Oct 2012, 10:38 AM
Tsvetina,

Thank you for your reply.  I first designed the grid with the horizonal scroll enabled, and everything worked smoothly.  The customer who ordered up this application rejected the horizontal scrolling and instead wanted it all crammed into a smaller space.  I guess I'm left with trying to fit a square peg into a round hole, so to speak.
0
Tsvetina
Telerik team
answered on 15 Oct 2012, 07:15 AM
Hi Patrick,

Even with scrolling disabled, if you correctly set the columns width, they should not get misaligned with the headers. Check if you have any ItemStyle-Width settings in the grid declaration, and if so remove them and use HeaderStyle-Width instead.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or