Export Radgrid

2 posts, 0 answers
  1. Karlheinz
    Karlheinz avatar
    14 posts
    Member since:
    Jul 2014

    Posted 07 Jul 2015 Link to this post

    Hello,

    I try to export RadGrid using the following code.

     

    static GridItemType[] supportedItemTypes = new GridItemType[] {
                GridItemType.GroupHeader,
                GridItemType.Header,
                GridItemType.AlternatingItem,
                GridItemType.Item,
                GridItemType.Footer,
                GridItemType.GroupFooter
            };
           
            private void AddGrid(Worksheet pWS,pssRadGrid pGrid) {
            
                foreach (GridItem item in pGrid.MasterTableView.GetItems(supportedItemTypes))
                    etc....

    within the foreach loop i get the items in that order:

    header
    footer
    item
    item
    etc.

     

    Is there a way to get the items in the right order for exporting

     

    header
    item
    item
    .
    .
    .
    footer

    Thanks in advance

     

  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 09 Jul 2015 Link to this post

    Hello Karlheinz,

    It is not possible to alter the way the items are ordered out of the box. The easiest way would be to do something like this (dummy code):
    GridItemType[] supportedItemTypes = new GridItemType[] {
            GridItemType.GroupHeader,
            GridItemType.Header,
            GridItemType.AlternatingItem,
            GridItemType.Item,
            /*GridItemType.Footer,*/
            GridItemType.GroupFooter

    foreach (GridItem item in pGrid.MasterTableView.GetItems(supportedItemTypes))
    {
        // add all items except footer
    }
     
    GridItem footer = pGrid.MasterTableView.GetItems(GridItemType.Footer)[0];
    //add footer

    Let me know whether this helps.

    Regards,
    Daniel
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top