Try Now
More in this section

Forums / Developing with Sitefinity / ListViewMode and sorting of LibraryListView

ListViewMode and sorting of LibraryListView

3 posts, 0 answered
  1. Tom
    Tom avatar
    19 posts
    15 Sep 2009
    17 Aug 2011
    Link to this post
    Hi there

    I try to influence the default ListViewMode and sorting of the LibraryListView. Therefore I downloaded the external template and made some changes. I assured that my template is used by adding custom text to it.

    To change the default ListViewMode I set the SelectedIndex attribute of RadTabStrip to 1 (which should be List). No effect... So I removed the SelectedIndex from RadTabStrip and set the Selected attribute of desired RadTab to true. Again no effect...

    I identified that there is a <SortingExpressions...> tag for RadGrid (inside MasterTableView). This works as expected. But I have no clue, how I may change the default order of the initial view (realized through iterator).

    Any hint will be appreciated!

    Kind regards,
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    22 Aug 2011
    Link to this post
    Hi Tom,

    Currently the libraries can be sorted only when being viewed in list mode. To make the grid listing libraries in list mode to sort them by name as a default, please map the ~/Sitefinity/Admin/ControlTemplates/Libraries/LibraryListView.ascx template and add the following server script:
    <script runat="server">
        protected void Page_Load()
            RadPageView listView = this.multiPage.FindPageViewByID("listView");
            if (listView != null)
                RadGrid librariesGrid = (RadGrid)listView.FindControl("librariesGrid");
                if (librariesGrid != null)
                    GridSortExpression Name = new GridSortExpression();
                    Name.FieldName = "Name";
                    Name.SortOrder = GridSortOrder.Ascending;
                    if (!librariesGrid.MasterTableView.SortExpressions.ContainsSortExpression(Name))

    To display the view in grid mode you can hide the boxes view. Apply the following modifications to your template:
    <p>View as:</p>
    <telerik:RadTabStrip ID="viewMode"
            <telerik:RadTab PageViewID="boxesView" runat="Server" Text="<%$Resources:Boxes %>" Visible="false"></telerik:RadTab>
            <telerik:RadTab PageViewID="listView" runat="server" Text="<%$Resources:List %>"></telerik:RadTab>

    And then hide the boxes view:
    <telerik:RadMultiPage ID="multiPage" runat="server" SelectedIndex="1">
        <telerik:RadPageView ID="boxesView" runat="server" Visible="false">

    Radoslav Georgiev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. Tom
    Tom avatar
    19 posts
    15 Sep 2009
    22 Aug 2011
    Link to this post
    Neat hint with the filter expression :)

    Unfortunately the second solution (visible=false and selectedindex=1) didn't work for me. I have tried this one before, without success... Have you checked it?
Register for webinar
3 posts, 0 answered