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

paging focus sepecific row

1 Answer 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
riki riki
Top achievements
Rank 1
riki riki asked on 11 May 2010, 03:57 PM
hello!

I use RadDataPager (page size = 10). I want to focus on a specific row. I tried this code:

private

 

 

void GV_Results_DataLoaded(object sender, EventArgs e)

 

{

 

    if (SelectedEntity != null)

 

        V_Result SelectedRow = (

 

from V_Result r in GV_Results.Items

 

 

 

        where r.R_ID.Equals(SelectedEntity.R_ID)

 

 

 

        select r).FirstOrDefault();

 

 

 

    GV_Results.SelectedItem = SelectedRow;

 

 

 

    int selectedIndex = GV_Results.Items.IndexOf(GV_Results.SelectedItem);

 

 

 

    if (selectedIndex != -1)

 

    {

 

 

        int pageIndex = selectedIndex / rpg_results.PageSize;

 

        rpg_results.MoveToPage(pageIndex);

    }
}
What happens is, in the data loaded function the grid loads only 10 records in each page index.
so if the wanted row is not in the first page, the SelectedRow is null. (because GV_Results.Items contains only the records that are in the first page).
And if I go to the page that contains the wanted row, the selectedRow is not null, but the selectedIndex will be 5 if the selected item was item number 15, and 7 if the selected index was actualy 27. Because
GV_Results.Items.IndexOf(GV_Results.SelectedItem); again behaves like it has only 10 items. 

How can I focus on the selected item if it is not in the firs page?

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 12 May 2010, 06:11 PM
Hi riki riki,

Currently it is not possible to select items that are not in the current view (in Items property). We are evaluating possible ways to allow such selection but it is still unclear when we will be able to introduce this functionality.


Best wishes,
Milan
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.
Tags
GridView
Asked by
riki riki
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or