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

[Solved] RadGridView Footer Text Alignment

6 Answers 248 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bryan Johnson
Top achievements
Rank 1
Bryan Johnson asked on 08 Oct 2010, 11:46 PM
I'm trying to align my aggregates in the footer of the gridview to the right using the following code but it is not working:

((

 

GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).FooterTextAlignment = TextAlignment.Right;

 

Please help.

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 11 Oct 2010, 07:16 AM
Hi Bryan Johnson,

I have tested the code-snippet you provided and everything works as expected on my side. Thus, in order to give you an appropriate solution, I would need more details about your project. Is the "cbitem.Content.ToString()" equal to the UniqueName of the column ?

 

All the best,
Maya
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
Bryan Johnson
Top achievements
Rank 1
answered on 11 Oct 2010, 02:22 PM
Hi Maya,

Yes I am using the unique column name.  Here is the entire code snippet.  Everything works except for the right alignment of the footer total.

case "Sum":
    {
        foreach (RadComboBoxItem cbitem in cmbField.Items)
        {
            SumFunction f = new SumFunction();
            f.ResultFormatString = "{0:n}";
            ((GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).AggregateFunctions.RemoveAll();
            ((GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).AggregateFunctions.Add(f);
            ((GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).HeaderTextAlignment = TextAlignment.Center;
            ((GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).TextAlignment = TextAlignment.Right;
            ((GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).FooterTextAlignment = TextAlignment.Right;
        }
        break;
    }
0
Maya
Telerik team
answered on 11 Oct 2010, 04:17 PM
Hi Bryan Johnson,

Unfortunately, this code-snippet does not allow me to make any further suggestion on the possible reason for the FooterTextAlignment not to work. What exactly is the whole setting of your RadGridView ? Any relevant code-snipper would be helpful.
 

Sincerely yours,
Maya
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
Bryan Johnson
Top achievements
Rank 1
answered on 11 Oct 2010, 04:28 PM
Maya,

I found the problem.  Even though I was setting the property in the C# code like I showed you it still would not right align the footer text.  However, when I set the FooterTextAlignment="Right" in the xaml it worked.  Could this be a bug with the gridview?  I would think that whichever way you set the property, it should be applied.  Thanks for the help.

-Bryan

0
Maya
Telerik team
answered on 12 Oct 2010, 07:26 AM
Hello Bryan Johnson,

Basically, there should be no reason for you not to be able to set the FooterTextAlignment Property in the code behind. Consequently, I do not believe there is a bug in the grid. However, if you provide us with a sample project (via support ticket) or code-snippets defining the grid, I may be able to test locally your exact scenario.
 

Kind regards,
Maya
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
Mike Shilkov
Top achievements
Rank 1
answered on 14 Oct 2010, 02:39 PM
I was experiencing a similar problem today. At some point, I was assigning FooterTextAlignment to right for all the columns, but couldn't see any changes.
Then, I moved this assignment earlier in lifecycle, to the point when grid column is created (also programmatically), and it started to work. I guess it used to be assigned too late, I'm not sure where this time point is... But that's my impression.
Tags
GridView
Asked by
Bryan Johnson
Top achievements
Rank 1
Answers by
Maya
Telerik team
Bryan Johnson
Top achievements
Rank 1
Mike Shilkov
Top achievements
Rank 1
Share this question
or