Update DocumentLink Widget

Posted by Community Admin on 04-Aug-2018 12:35

Update DocumentLink Widget

All Replies

Posted by Community Admin on 15-Jun-2012 00:00
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)
        
This thread is closed