Last post Oct 03, 2019 08:55 PM by WilliamSnell
Oct 03, 2019 08:11 PM|WilliamSnell|LINK
My app allows users to upload documents that are saved to blob storage, and also to a database record for extra bits of data required. When a details view is loaded, the document for that record is displayed in the browser. To get this to work, I grab the
document from blob storage and convert it to a Base64 string. Unfortunately, this is a slow process, and I need the page to load fast. What I'd like to do is skip the Base64 conversion when the page is first rendered, and run a process in the background to
perform the conversion and load it into the page's model. Usually I'd just run an ajax call and feed the result into an input element, hidden or otherwise, but I'm rendering the document with an object tag, and am assigning the content from the view model.
I just need to update the page's model after loading, but I have no idea how to accomplish it.
<object id="DocumentViewer" data="data:@Model.DocumentViewModel.ContentType;base64,@Model.DocumentViewModel.Base64" type="@Model.DocumentViewModel.ContentType"></object>
Oct 03, 2019 08:55 PM|WilliamSnell|LINK