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

[Solved] Is it possible to align data in the grid to the right?

2 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
scott weinstein
Top achievements
Rank 1
scott weinstein asked on 13 May 2010, 10:20 PM
Instead of
|xxxx    |

I'd like a way to do

|    xxxx|

what are the options?


2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 14 May 2010, 07:18 AM
Hello scott weinstein,

You can achieve your goal using HtmlAttributes method of each column to apply required styles. For instance you can achieve your goal with the following code snippet:
<%= Html.Telerik().Grid<OrderDto>(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).Width(100).HtmlAttributes(new { style = "text-align:right" });
...

Best wishes,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
scott weinstein
Top achievements
Rank 1
answered on 14 May 2010, 03:01 PM
Fantastic!

I've seen that there's some support for Data Annotations. Would it be feasible to mark up my model with a custom annotation so that my string format and html attributes are applied automagically?

instead of 
var nfmt = "{0,10:0,0 ;; }";
...
c.Bound(o => o.Funding).Format(nfmt).HtmlAttributes(new{style="text-align: right"});

just 
c.Bound(o => o.Funding)


Tags
Grid
Asked by
scott weinstein
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
scott weinstein
Top achievements
Rank 1
Share this question
or