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

Add the total of row under the row number

5 Answers 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas LEBRUN
Top achievements
Rank 1
Thomas LEBRUN asked on 04 Nov 2009, 10:35 AM
Hi,

I'm trying to add the total number of row in the grid but i want to display it under the row number (see pic).
I've use the code below:

public

 

void SetTextBoxTotalFooter()

 

{

 

// Set the binding on the footer containing the number of row

 

 

var indicatorPresenter = this.FooterRow.ChildrenOfType<IndicatorPresenter>().First();

 

 

var grid = indicatorPresenter.ChildrenOfType<Grid>().First();

 

 

var tb = new TextBlock

 

{

HorizontalAlignment =

HorizontalAlignment.Center,

 

VerticalAlignment =

VerticalAlignment.Center,

 

Text =

this._Xwg.Items.Count.ToString()

 

};

 

if (grid.Children.Count == 1)

 

{

grid.Children.Insert(1, tb);

}

 

else

 

{

grid.Children[1] = tb;

}

}



It works fine except that if number is important (more that 999), the content of the TextBlock is not displayed correctly (some number are truncated).

Any ideas on how to solve that ?


Thanks !

5 Answers, 1 is accepted

Sort by
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 04 Nov 2009, 11:24 PM
Nobody got an idea ?


Thanks !
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 06 Nov 2009, 12:35 PM
Nobody ? :(
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 08 Nov 2009, 08:14 PM
Anyone got an idea ? Is this a not possible scenario ?


Thanks !
0
Kalin Milanov
Telerik team
answered on 09 Nov 2009, 10:47 AM
Hi Thomas,

One possible solution to your case is to edit the templates of the rows and increase the width for the indicator as to allocate space for larger numbers. It is important to note that the change is best applied to all rows (Row, HeaderRow, GroupRow, FooterRow and GroupFooterRow) so that you will have no misalignments when grouping and/or showing totals.

That being said we realize that this solution is not ideal since you can end up with 9 digit numbers or some other content which will require further customizations. We will discuss this issue internally in hope of providing a more streamlined approach to cases like this in the future.

Greetings,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 09 Nov 2009, 10:50 AM
Hi,

Thanks for your response. Do not forget to let me know of you find a better way to handle this [;)]


Thanks !
Tags
GridView
Asked by
Thomas LEBRUN
Top achievements
Rank 1
Answers by
Thomas LEBRUN
Top achievements
Rank 1
Kalin Milanov
Telerik team
Share this question
or