0
我需要打印下我的問題if語句總是打印文本
所有的代碼,如果在@store.GuaranteePolicy
打印所有<tr>
數據。如果沒有數據,則不會打印任何內容。
無論@store.GuaranteePolicy
中是否有數據,「付款」總是打印,但爲什麼?
我說,如果(store.GuaranteePolicy比空不同,則打印)
if語句正在與此:
- 如果在
store.GuaranteePolicy
一切數據打印完美 如果在
store.GuaranteePolicy
沒有數據的文本沒有打印,但字付款方式:打印。所以即使它不是真的,整個<tr>
也會被打印出來?@if (store.GuaranteePolicy != null) { <tr> <th class="small-12 large-6 columns first"> <table> <tr> <th width="300"> <p class="text-left small-text-left"><strong>Payment:</strong></p> </th> </tr> </table> </th> <th class="small-12 large-6 columns last"> <table> <tr> <th width="300"> <p class="text-left small-text-left"> <span>@store.GuaranteePolicy</span> </p> </th> <th class="expander"></th> </tr> </table> </th> </tr> }
你有debuged您的應用程序和看看store.GuaranteePolicy的價值是什麼,當你認爲它不應該是公關inted? –
我不知道它是什麼,但有沒有一個零項目列表或類似的東西?默認值? – TheLethalCoder
也許嘗試使用Count()方法,如果它是一個集合並且與0 – daniell89