((
GridViewDataColumn)this.SalesAnalysisGrid.Columns[cbitem.Content.ToString()]).FooterTextAlignment = TextAlignment.Right;
Please help.
6 Answers, 1 is accepted
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 ?
Maya
the Telerik team
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; } 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.
Maya
the Telerik team
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
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.
Maya
the Telerik team
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.