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

SelectRow on another page

6 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 22 Jul 2010, 09:39 AM
Hi.

I've been looking at the following example of your site:
http://www.telerik.com/help/aspnet-ajax/grdpersistselectedrowsonsorting.html

It seems to work ie it selects the row with out a problem, but what I then need it do is go to the page that the selected row exists on. Is this possible?

Thanks

6 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 22 Jul 2010, 03:02 PM
Hi Karl,

In order to achieve your goal, you can try looping through the current page items and if there is no selected items there navigate to the next page and repeat the procedure again.
Another option is to get the first item of the selectedItems array, find which is its index in the grid datasource and based on that to navigate to the corresponding page in the grid.

Try it out and let me know if you need further assistance.

Greetings,
Iana
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
Karl
Top achievements
Rank 1
answered on 28 Jul 2010, 09:07 AM
Hi,

Thanks, would it be possible to take a look at the below code for me, Ithink I'm close but missing something?
for (int i = 0; i < MyGrid.MasterTableView.PageCount; i++)
{
    MyGrid.CurrentPageIndex = i; // set the page index to the current page  
    MyGrid.Rebind();
    //foreach (GridDataItem dataItem in MyGrid.MasterTableView.Items)
    for (int z = 0; z < MyGrid.Items.Count; z++)
    {  
        //if (dataItem.Selected == true)
        if (MyGrid.Items[z].Selected == true)
        {
            break;
        }
    }
    //MyGrid.CurrentPageIndex = pageCount;
}
0
Iana Tsolova
Telerik team
answered on 30 Jul 2010, 12:52 PM
Hi Karl,

I checked the code and I was not able to find any issues with it. Can you specify what is the unexpected behavior you observed?

Kind regards,
Iana
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
Karl
Top achievements
Rank 1
answered on 30 Jul 2010, 04:07 PM
Hi,

I followed this example on your site, which works great to select the row:
http://www.telerik.com/help/aspnet-ajax/grdpersistselectedrowsonsorting.html

However it doesn't show the page that the selected row is on. It won't go to the page, just moves to the last page. Any ideas?

Thanks
0
Karl
Top achievements
Rank 1
answered on 03 Aug 2010, 08:55 AM

Hi,

I've just realized why its not working, the sample on your site will only select the row when you click on the page corresponding to the selected row. When I go to look for the selected row it can’t find it because its not even selected.

 

How can I select a row and move to the page that corresponds to the selected row?

 

Thanks

0
Karl
Top achievements
Rank 1
answered on 03 Aug 2010, 01:28 PM
Hi,

I've sorted this now, I just used your example and put the loop in my paging loop and it works fine.

Thanks
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Karl
Top achievements
Rank 1
Share this question
or