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

Display Row Number

2 Answers 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian Baker
Top achievements
Rank 1
Brian Baker asked on 09 Sep 2010, 08:35 PM
Hi, I would like to be able to display the rownumber in my gridview.  I want to use this as a displayable sequence.  Is there a way that I can display this?

thanks

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Sep 2010, 07:21 AM
Hi,

 You've missed this demo

Regards,
Vlad
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
Amit Patel
Top achievements
Rank 1
answered on 15 Dec 2011, 04:32 PM
Hello,

I like to be able to display row number on the row header. I was able to pull this off, but the numbers are not always display in right order when 1000 of row are loaded. (see the attached image) I put the blow code in RowLoaded event of the grid.

Please advice if there is any sophisticated way to do this. 

Thanks,
Amit
var border = gridViewRow.ChildrenOfType<Border>() .Where(b => b.Name == "PART_IndicatorPresenter") .FirstOrDefault(); 
if (border != null)
{
var innerBorder = border.Child as Border;
if (innerBorder != null && !(innerBorder.Child is TextBlock))
{
var textBlock = new TextBlock();
textBlock.TextAlignment = TextAlignment.Center;
textBlock.VerticalAlignment = VerticalAlignment.Center;
textBlock.Text = (_target.Items.IndexOf(gridViewRow.Item) + 1).ToString();
innerBorder.Child = textBlock;
}

Tags
GridView
Asked by
Brian Baker
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Amit Patel
Top achievements
Rank 1
Share this question
or