Home Razor escape quotes in HTML
Reply: 0

Razor escape quotes in HTML

user1734 Published in March 24, 2018, 2:26 am

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">
      <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>
     @foreach (var row in BSDB.TempOrderA("TempOrderID='" + TknParams.TempOrderID + "'")) {
      <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>

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.298628 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO