+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Removing columns in Download List template

Removing columns in Download List template

2 posts, 0 answered
  1. Tyler
    Tyler avatar
    7 posts
    Registered:
    21 Aug 2012
    27 Aug 2013
    Link to this post
    I have modified the default download list template to have custom fields that I am using in association with the document manager.

    I am now trying to remove the documentType and totalSize columns of the template.

    When I comment them out, I get a server error:
    Cannot find a cell bound to column name 'documentType'

    Here is my code:
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
    <%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <sitefinity:ResourceLinks id="resourcesLinks2" runat="server" UseEmbeddedThemes="true" Theme="Default">
      <sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Basic.Styles.icons.css" Static="true" />
    </sitefinity:ResourceLinks>
    <sf:BrowseAndEditToolbar ID="browseAndEditToolbar" runat="server" Mode="Edit"></sf:BrowseAndEditToolbar>
    <telerik:RadGrid id="documentsGrid" runat="server"
        CssClass="sfdownloadTable sfTableMode"
        skin="Sitefinity">
        <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="true" />
        <PagerStyle Mode="NumericPages" />
        <MasterTableView PageSize="50" EnableNoRecordsTemplate="true">
            <Columns>
                 
                <telerik:GridBoundColumn UniqueName="title" HeaderText="<%$ Resources:Labels, File %>" DataField="Title" ItemStyle-CssClass="sfdownloadTitle" HeaderStyle-CssClass="sfdownloadTitle" />
                <%--  <telerik:GridBoundColumn UniqueName="documentType" HeaderText="<%$ Resources:Labels, Type %>" DataField="Extension" ItemStyle-CssClass="sfdownloadType" HeaderStyle-CssClass="sfdownloadType" /> --%>
                <telerik:GridBoundColumn UniqueName="totalSize" HeaderText="<%$ Resources:Labels, Size %>" DataField="TotalSize" ItemStyle-CssClass="sfdownloadSize" HeaderStyle-CssClass="sfdownloadSize" />
                <telerik:GridBoundColumn UniqueName="uploadedOn" HeaderText="<%$ Resources:Labels, UploadedOn %>" DataField="DateCreated" DataFormatString="{0:dd MMM, yyyy}" ItemStyle-CssClass="sfdownloadDate" HeaderStyle-CssClass="sfdownloadDate" /> 
                
                <%-- Custom Column  --%>
                <telerik:GridTemplateColumn
                    UniqueName="actionColumn"
                    HeaderText="Download/Link"
                    ItemStyle-CssClass="sfdownloadCell" HeaderStyle-CssClass="sfdownloadCell">
                    <ItemTemplate>
                      <a href="<%# (Eval("FormURL") ==  null ) ? Eval("MediaUrl") : Eval("FormURL") %>" ><%# (Eval("FormURL") ==  null ) ? "Download" : "Access Smart Form" %></a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
     
                <%-- Custom Column  --%>
                <telerik:GridTemplateColumn
                    UniqueName="deptartmentColumn"
                    HeaderText="Department"
                    ItemStyle-CssClass="sfdownloadCell" HeaderStyle-CssClass="sfdownloadCell">
                    <ItemTemplate>
                        <%# Eval("Department") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
     
            </Columns>
            <NoRecordsTemplate>No documents found!</NoRecordsTemplate
             
        </MasterTableView>
    </telerik:RadGrid>
    <sitefinity:Pager id="pager" runat="server"></sitefinity:Pager>
     
     
     
       
      


    Please advise. Thank you.
  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    29 Aug 2013
    Link to this post
    Hello Tyler,

    Removing the columns from the template would result in error since the code of the widget searches for those columns. The easiest and fastest way to hide the unwanted columns is to set their Visibility to false.

    <telerik:GridBoundColumn Visible="false" UniqueName="documentType" HeaderText="<%$ Resources:Labels, Type %>" DataField="Extension" ItemStyle-CssClass="sfdownloadType" HeaderStyle-CssClass="sfdownloadType" />


    I hope this helps. 

    Regards,
    Pavel Benov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered