Home MVC Razor build onclick event dynamically to show modal
Reply: 0

MVC Razor build onclick event dynamically to show modal

user1611 Published in March 19, 2018, 1:17 am

I am currently trying to attach a click handler to my <a> tag which will pop up my modal which has a dynamic id. I am having trouble figuring out the syntax to accomplish this- my current attempt can be found below and has a syntax error on onclick="$('#"+ @modalId + "')" (which is the part im struggling a bit with). How can I accomplish this?

var modalId = string.Format("docusign{0}", doc.Id)
<a href="#" onclick="$('#"+ @modalId + "').modal('toggle')">@string.Format("Document {0}", EnumHelper.GetDisplayName(doc.DocumentType))</a>

<div id="@modalId" class="modal fade" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header" style="background-color:#337ab7;color:#ffffff">
         <button type="button" class="close" data-dismiss="modal">&times;</button>
         <h4 class="modal-title">DocuSign Notice</h4>
      <div class="modal-body form-group">
      <h5>Please allow up to 10 minutes for us to receive your e-form after you have completed it. To continue and fill out the necessary e-form, please click the "Fill Form" button below</h5>
    <div class="modal-footer">
      <button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>
      <a class="btn btn-default pull-left" href=@doc.DocuSignPowerFormLink>Fill Form</a>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299463 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO