More in this section

Forums / General Discussions / Displaing Tags in DownloadList

Displaing Tags in DownloadList

5 posts, 0 answered
  1. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    02 May 2011
    Link to this post
    Hello,
    I'm tring to add a column to a DownloadList (table view) for showing the tags I've added to a document... how can I add it? clicking on the right to Tags gaves me

    <sitefinity:FlatTaxonField ID="FlatFieldControl" DisplayMode="Read" runat="server" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc" AllowMultipleSelection="true" TaxonomyId="CB0F3A19-A211-48a7-88EC-77495C0F5374" TaxonomyMetafieldName="Tags" Expanded="false" ExpandText="ClickToAddTags" BindOnServer="true" />

    Where should  I put this?
    Thanks
    Paolo
  2. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    04 May 2011
    Link to this post
    hello,
    can anyone please help me on this?
    Thanks
    Paolo
  3. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    05 May 2011
    Link to this post
    I need exacly to do what you do in the Document & Files
  4. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    09 May 2011
    Link to this post
    heeeeeelpppppp ... anyone can give me a feedback please?
  5. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    11 May 2011
    Link to this post
    Hi Paolo,

    There is a way to display tags for each document, however it involves custom code and is not so trivial. The steps you need to follow:
    • Override the Table master view
    • Change its template and implement the binding of the custom column
    • Register the new view with DownloadList configuration
    • Use the new view in DownloadList control on a page
    I've attached an archive with the implemented custom view, which contains:
    • CustomMasterTableView.cs - our custom view
    • CustomMasterTableView.ascx - the template for the view (we've added one more column to the grid)
    Extract those two files in the root of your web project. To use this view, you need to register it in the definitions of the DownloadList control. To do so, go to Administration -> Settings -> Advanced -> ContentView -> Controls -> FrontendDocuments -> Views -> MasterTableView. Copy all values somewhere, because we'll need to duplicate them.
    Then click the parent Views node in the tree and CreateNew -> DownloadListViewMasterElement. This will create another item in the tree. Input the values we copied in the previous step, with only two differences:

    For View name, specify "CustomMasterTableView".
    For View type, specify "Sitefinity.Samples.CustomMasterTableView"

    Click Save.

    Now that your view is registered, the rest of the work is just instructing DownloadList to make use of our new master view. This can be achieved by setting the MasterViewName property of the DownloadList control, and currently can only be done through code. The following snippet creates a new instance of DownloadList, tells it to use our new master view, and puts it on a page called "Documents", which you should create before running it:

    var pageId = App.WorkWith().Pages().Where(p => p.Title == "Documents").Get().FirstOrDefault().Id;
     
    var downloadList = new DownloadListView();
    downloadList.MasterViewName = "CustomMasterTableView";
     
    App.WorkWith().Page(pageId).AsStandardPage().CheckOut().Control().CreateNew(downloadList, "Body").SaveChanges().Done().Publish().SaveChanges();

    You can change the above code to either get a control you've already put on a page, or put a new instance on another page. Once you open this "Documents" page, you should see a new column in the grid displaying documents, which shows what tags they've been tagged with. 

    Regards,
    Slavo
    the Telerik team
    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
5 posts, 0 answered