Download a document directly from a list in WebDrawer

Show Me

The default WebDrawer behaviour requires the user to open the Record details page before they can preview or download the electronic document.  This allows for a simple UI design that is easily made responsive to different screen sizes.  If you would prefer to be able to access the document without first opening the details page this post details some template customisations that will get you there.


Here is the source as demonstrated in the video. You may have noted that I overlooked something, when I added the RecordIsElectronic property to the 'properties' in hptrim.config this had the effect of also adding it to my view.  In MySearchResults.cshtml I have added some code to exclude that property.  It looks something lke this...

The exclusion list

string[] columnsToIgnore = new string[] { "RecordExtension", "RecordIsElectronic" };

The if statement

if (!columnsToIgnore.Any(id => id == pfdef.Id))


If the code in MySearchResults.cshtml is a little too complex for your liking, for example we loop through Model.PropertiesAndFields[this.TrimHelper.TrimType] to get the list of properties to display based on the properties specified in hptrim.config.  You might choose to replace this block with something more like the simple table in this example.