Home Razor escape quotes in HTML
Reply: 0

Razor escape quotes in HTML

UserSN
1#
UserSN Published in 2017-12-04 18:01:26Z

I'd like to use @row.TempOrderID as the query string variable in my onclick event but it's not passing correctly in my code. Probably a syntax issue.

<div class="table-responsive"> 
<div class="dg-scroll-horizontal">
 <table class="table table-striped table-condensed table-bordered" style="table-layout: auto;" width="100%" border="0">
  <tbody>
    <tr>
      <th scope="col">Type</th>
      <th scope="col">Company</th>
      <th scope="col">Contact Person</th>
      <th scope="col">Phone</th>
      <th scope="col">Email</th>
    </tr>
     @foreach (var row in BSDB.TempOrderA("TempOrderID='" + TknParams.TempOrderID + "'")) {
    <tr>
      <td>@row.OrganizationType</td>
      <td>@row.CC_Company</td>
      <td>@row.CC_Contact</td>
      <td>@row.CC_Phone</td>
      <td>@row.CC_Email</td>
      <td style="text-align: center;"><a class="btn btn-info" href="/dev/Client-Info" onclick="return dnnModal.show('/dev/Client-Info?popUp=true&TempOrderID=@row.TempOrderID',true,550,550,false)"><i class="fa fa-search"></i></a></td>
    </tr>
    }
</table>
</div>
</div>

Adding two sets of double quotes "" does escape correctly but then my URL is not properly formatted IE:

<a class="btn btn-info" href="/dev/Client-Info" onclick="return dnnModal.show('/dev/Client-Info?popUp=true&amp;TempOrderID=" "2""',true,550,550,false)"=""><i class="fa fa-search"></i></a>
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO