Get the order of items

4 posts, 0 answers
  1. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 04 Aug 2008 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Aug 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 06 Aug 2008 Link to this post

    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?

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Aug 2008 Link to this post

    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.
Back to Top