none
Sorting Control - Dataview Webpart Sharepoint 2010

    Question

  • Hi All,

    I have used a Sharepoint Data view webpart in my project and customized its look and fell implemeted filter control too.

    Now i need to enhance the features ... Can any one help me in developing a Sorting Control thru which the Data view gets sorted based on each column . On click of a button it must get sorted ascending and by default it must be descending .

    Thanks,

    Pallavi


    Monday, January 07, 2013 5:55 AM

Answers

  • Hi Pallavi,

    Firstly, kindly recheck your web part, is it a list view web part or data view web part.

    (List view web part is created in this way in SharePoint Designer: Insert > Data View > Select target list.
    Data View Web Part: Insert > Data View > Empty Data view > Select target list.)

    For a List view web part, sorting and filtering on list header option is already enabled by default. So next step, we only need to sort list in Descending order as the default sorting order:

    Click Sort & Group under “Options” tab in SharePoint Designer > Add the columns you need them display in descending order under “Sort order” > Select “Descending” under “Sort properties” option for each of the columns.

    For a data view web part.

    1. Same step with list view web part. Sort all columns in descending order by clicking “Sort & Group” > Add columns under “Sort order” > Select “Descending” under “Sort properties”.
    2. Enable “Sort & Filter on Header” option under Design tab and done.

    Now, we list is sort in descending order by default, and we can sort and filter the data view by clicking the column header.

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by Pallavi G.L Wednesday, January 09, 2013 5:04 AM
    Tuesday, January 08, 2013 7:35 AM

All replies

  • Hi Pallavi,

    Firstly, kindly recheck your web part, is it a list view web part or data view web part.

    (List view web part is created in this way in SharePoint Designer: Insert > Data View > Select target list.
    Data View Web Part: Insert > Data View > Empty Data view > Select target list.)

    For a List view web part, sorting and filtering on list header option is already enabled by default. So next step, we only need to sort list in Descending order as the default sorting order:

    Click Sort & Group under “Options” tab in SharePoint Designer > Add the columns you need them display in descending order under “Sort order” > Select “Descending” under “Sort properties” option for each of the columns.

    For a data view web part.

    1. Same step with list view web part. Sort all columns in descending order by clicking “Sort & Group” > Add columns under “Sort order” > Select “Descending” under “Sort properties”.
    2. Enable “Sort & Filter on Header” option under Design tab and done.

    Now, we list is sort in descending order by default, and we can sort and filter the data view by clicking the column header.

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by Pallavi G.L Wednesday, January 09, 2013 5:04 AM
    Tuesday, January 08, 2013 7:35 AM
  • Hi emri,

    I had another query related to sorting ,I i use the default sorting in a data view webpart i can not sort more than one column at a time.

    Is there any way were we can sort more than one column at a time.

    Thanks,

    Pallavi

    Wednesday, January 09, 2013 6:18 AM
  • Hi Pallavi,

    We can also sort data view by multiple columns by adding all those columns to Sort & Group option. And data view will first sort by the first column added in Sort & Group and then sort by the second column...

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    Wednesday, January 09, 2013 7:11 AM
  • Hi Emir,

    I agree that i can sort the data view based on many columns using the Sort and Group Otion in desginer .

    My query was when i use the Sorting Control (Sort and Filter on header) , i am not able to sort based on more than one column it works only with One column at a time.

    Thanks,

    Pallavi

    Wednesday, January 09, 2013 9:52 AM