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

Get the order of items

3 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 05 Aug 2008, 03:55 AM
so what i try to archive is that when user click the "view" button. it goes to another page with a navigation of "1(current)/10(total), previous, next, first, last".

the problem araises that how do i get the current index of the selected item according to the sort order? (user sorts by click the header)

any suggestion will be helpful

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Aug 2008, 06:28 AM
Hello James,

Once sorted the ItemIndex changes , so what I understand is that you would want to persist the selected rows on sorting. In that case, this link would help you achieve the result.

Thanks
Princy.
0
James Shelton Agar
Top achievements
Rank 2
answered on 06 Aug 2008, 05:12 AM

it's a difficult problem to explian...

but make it simple, how do i retreive all "Primary Keys" in the sort order after grid sorting?

0
Shinu
Top achievements
Rank 2
answered on 06 Aug 2008, 05:33 AM
Hi James,

Try setting the PrimaryKey as the DataKeyName so that you can access it in the PreRender event.

ASPX:
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"


CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            string strKey = item.GetDataKeyValue("ProductID").ToString(); 
        } 
    } 


Shinu.
Tags
Grid
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
James Shelton Agar
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or