Display Row Number

3 posts, 0 answers
  1. Brian Baker
    Brian Baker avatar
    10 posts
    Member since:
    Mar 2010

    Posted 09 Sep 2010 Link to this post

    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?

  2. Vlad
    Vlad avatar
    11100 posts

    Posted 10 Sep 2010 Link to this post


     You've missed this demo

    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
  3. Amit Patel
    Amit Patel avatar
    71 posts
    Member since:
    Sep 2009

    Posted 15 Dec 2011 Link to this post


    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. 

    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;

Back to Top