c# - String.Format with a string containing html -


this question has answer here:

i working on application fetches email templates database , sends them.

the template database has body has html, how can string.format on string? getting error saying input string not in right format.

    <!doctype html> <html> <head> </head> <body>     <style>         .container {             font-size: 0;         }              .container.p.span {                 /*font-size: 16px;**/             }          .titletextspan {             color: white;             width: inherit;             height: inherit;             font-family: sans-serif, arial;             font-size: 20px;             display: table-cell;             vertical-align: middle;             text-align: left;         }     </style>     <div class="container" style="width:700px;">         <div style="display:inline-block;">         </div>         <div style="width:700px;height:44px; background:#36a6de;display:table;">             <span class="titletextspan">product name</span>         </div>         <div style="font-size:10pt;margin-left:20px;font-family:arial, sans-serif;color:#4d4c4c">             <br />             dear {16},             <br /><br />             thank request product name, organisation approver authorisation.             <br />             call details:             <br />             call number: {17}             <br />             organisation approver: {22} {23}             <br />             <br />             if have other questions please not hesitate contact us.<br />             please email <a href="email">email</a> or contact local team lead.             <br />             <br />             kind regards,             <br />             <br />             intelligence point administrator         </div>         <div style="margin-top:20px;width:700px;height:10px; background:#36a6de;display:table;"></div>         <div style="width:700px;height:20px; background:#f1f1f1;display:table;"></div>         <div style="width:700px;height:50px;background:#15314d;text-align:center;display:table">             <span style="font-size:9pt; vertical-align:middle;color:#36a6de; font-family:arial, sans-serif;display:table-cell;">                 welcome comments, feedback , suggestions             </span>         </div>         <div style="font-size:10pt; vertical-align:middle;color:black; font-family:arial, sans-serif;text-align:center;">             <b>email:</b><a href=""> </a> | <b>website:</b> <a href=""></a>         </div>     </div> </body> </html> 

you need escape each { , } in html {{ , }} string.format considers them placeholder , not css rules. btw can use string.replace replace values other field before using string.format


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -