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

Forums / Bugs & Issues / Update DocumentLink Widget

Update DocumentLink Widget

1 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    15 Jun 2012
    Link to this post
    Problem with the DocumentLink widget is that it doesn't expose the underlying document object for us to extend the widget template.  So in the Document LIST control I have access to all the custom properties bound to the RadListView, but the single Document Link control just (interally) finds the document, then sets the hyperlink Text and NavigateUrl then the object just goes poof...

    **EDIT** Also there's no template key, so this blog post doesn't work

    Can you instead do something like this?
    private Document _document = null;
            public Document Document
            {
                get
                {
                    if (_document == null)
                    {
                        var manager = LibrariesManager.GetManager();
                        var documentId = this.DocumentId;
                        _document = manager.GetDocuments().Where(d => d.Id == documentId).Where(PredefinedFilters.PublishedItemsFilter<Document>()).SingleOrDefault();
                    }
     
                    return _document;
                }
                set
                {
                    _document = value;
                }
            }

    protected override void InitializeControls(GenericContainer container)
    {
        if (this.DocumentId != Guid.Empty)
        {
            var document = this.Document;
            if (document != null)
            {
1 posts, 0 answered