繁体   English   中英

如何在c#中使用表格的html隐藏具有条件的特定li项

[英]How to hide particular li item with condition using html of table in c#

我有一张桌子。 我需要根据条件隐藏细节。 我试过了,但没有得到解决方案。 请帮我。 下面是我的代码

  private string GenerateInvoiceTable(IInvoiceResponeForPdf invoice)
        {
            return $@"<table  style='width:120mm;font-size:20pt;font-family:tahoma;border-collapse:collapse;'>
                        <thead> 
                             <div style='text-align:center; width:25%'>
                             <ui class='list-unstyled'>
                                    <li style='font-weight:bold;'>Ramkrishna </li>
                                    <li>Begum Bazar,</li>
                                    <li>Hyderabad - 500012,</li>
                                    <li>Telagana, Code : 36,</li>                               
                                    **<li style='visibility: ${invoice.InvoiceType != "Estimation"} ? $'visible' : $'hidden''>M: 1234567898,Ph: 040-2222222,</li>
                                    <li>GSTIN: abcdezjsj. </li>**                                                                                               
                             </ui>
                            </div>
                            <div style='text-align:center; width:25%'>
                             <h4>Retail Invoice </h4>
                            </div>
                       </thead>                             
                        {GenerateInvoiceTableBody(invoice)}
                        {GenerateInvoicefooter(invoice)}
                    </table>";
        }

我尝试了不同的方法,但没有得到解决方案。 如果发票类型为"estimation"我需要隐藏联系电话和 gstin 号码。 请帮我

将表达式括在括号中

<li style='visibility: {(invoice.InvoiceType != "Estimation" ? "visible" : "hidden")}'>M: 1234567898,Ph: 040-2222222,</li>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM