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

Display Row Number

9 Answers 220 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott Rakestraw
Top achievements
Rank 1
Scott Rakestraw asked on 19 Nov 2009, 08:39 PM
Is there an easy way to add the row number to the indicator presenter?

9 Answers, 1 is accepted

Sort by
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 20 Nov 2009, 08:22 AM
Yes, I agree; it would be very useful (that and the possibility to have the total number of rows)....
0
Milan
Telerik team
answered on 20 Nov 2009, 08:21 PM
Hi Scrott,

The indicator cells are not very customizable at the moment and I would suggest to hide the indicator column and create another regular column to simulate the behavior of the indicator one. Once you do that it is very easy to display the row numbers. 

I have prepared a solution that demonstrates how this can be done in two different ways. 

Also it is very easy to determine the total number of rows by inspecting the RadGridView.Items.Count property.

Hope this helps.


Best wishes,
Milan
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 21 Nov 2009, 12:16 PM
Hi Milan,

The solution you provided is correct but not valid for me: my customer ask me to insert the row number in the cell where is the indicator presenter. After looking at the template and using a converter, i've managed to do it (ie: i've the row number when the line is not selected and the indicator presenter when the line is selected), but i've an issue: if there are a lot of line (more than 1000), the column of the indicator presenter/row number is not expanding so the row number is truncated.

You can see a capture/image of the issue here: http://img689.imageshack.us/img689/1356/capturepw.jpg

Any ieas ?


Thanks !
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 24 Nov 2009, 10:26 AM
Hi,

Any ideas on that ?


Thanks !
0
Thomas LEBRUN
Top achievements
Rank 1
answered on 25 Nov 2009, 03:49 PM
Nobody got an idea ? This is a quite urgent problem for us because we'll be in production in a few days :)
0
Milan
Telerik team
answered on 25 Nov 2009, 08:34 PM
Hello Thomas LEBRUN,

The easiest way to resize the indicator columns is by using the row loaded event:

public MainPage()
{
    InitializeComponent();
  
    this.playersGrid.ItemsSource = Club.GetPlayers();
    this.playersGrid.RowLoaded += new System.EventHandler<Telerik.Windows.Controls.GridView.RowLoadedEventArgs>(playersGrid_RowLoaded);
}
  
void playersGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
    var indicatorPresenter = e.Row.ChildrenOfType<Border>().Where(el => el.Name == "PART_IndicatorPresenter").FirstOrDefault();
  
    if (indicatorPresenter != null)
        indicatorPresenter.Width = 200;
}

Hope this helps.

Best wishes,
Milan
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 26 Nov 2009, 12:39 PM
Hi Milan,

I've tried your code. It works fine exception that:
- the aggregate funtion (in custom footer) no longer display the result.(as you can see in image attached)
- The alignment is not well formated/not corrected (as you can see in image attached)


Any ideas ?


Thanks !
0
Milan
Telerik team
answered on 01 Dec 2009, 04:47 PM
Hi Thomas LEBRUN,

It seems that the misalignment occurs because the indicator presenter of the footer is does not have enough space. Could you please try to increase the size of all indicator presenters so that numbers like "5827" have enough space to be displayed. 

I have also tried to reproduce the other problem but without any luck. Could you please share which version of RadGridView are using at the moment? 


All the best,
Milan
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 02 Dec 2009, 08:23 AM
Hi Milan

Increasing the size of all indicator presenters do the trick, i should have tought to it....


Thanks !
Tags
GridView
Asked by
Scott Rakestraw
Top achievements
Rank 1
Answers by
Thomas LEBRUN
Top achievements
Rank 1
Milan
Telerik team
Share this question
or