title: How to view the content of base64 string in a mvc jquery modal
body: <p>I am saving the file content by converting to <strong>ToBase64String</strong> to my database. The file can be any type like image or excel or word or pdf and so on. Now I would like to view the file upon clicking the view icon. I did some research and found this</p>
  <p><a href="https://www.aspsnippets.com/questions/168961/Display-file-preview-in-jQuery-modal-popup-from-database-path-on-ASPNet-GridView-LinkButton-Click-using-C-and-VBNet/" rel="nofollow noreferrer">https://www.aspsnippets.com/questions/168961/Display-file-preview-in-jQuery-modal-popup-from-database-path-on-ASPNet-GridView-LinkButton-Click-using-C-and-VBNet/</a></p>
  <p>But I couldn't make it as per my requirement. I would like to create a partial view and display the content which was saved to database as <strong>ToBase64String</strong> and provide a download button so that user can download the file</p>
  <p>I am able to download directly using the following code but I would like to make it to a partial view and provide download option there</p>
  <pre><code>public ActionResult Index()
  {
     AttachmentRepository attachmentRepository = new AttachmentRepository();
     var result = attachmentRepository.GetDocument(&quot;Environment&quot;, 1);
     return File(result.AttachmentData, result.AttachmentType, result.AttachmentName);
  }
  </code></pre>