0
我試圖執行一個三元如果我的數據綁定爲一箇中繼器內聲明綁定:如果內部數據語句轉發
<%# If(Container.DataItem.rDate.isEmpty, String.Empty, Format(Container.DataItem.rDate.Date, "Short Date"))%>
這應該是等同於:
If rDate.isEmpty then
String.Empty
Else
String.Format(rDate, "Short Date")
End If
然而,我在運行時得到一個編譯錯誤:期望表達式@
<%# If(Container.DataItem.rDate.isEmpty, String.Empty, Format(Container.DataItem.rDate.Date, "Short Date"))%>
任何關於這裏有什麼錯誤的想法?
的可能重複[有沒有在VB.NET有條件的三元運算符?( http://stackoverflow.com/questions/576431/is-there-a-conditional-ternary-operator-in-vb-net) –
@IlyaBursov我知道有一個三元操作符,我的問題與我爲什麼是我在我的數據綁定中出現錯誤。 – Popo
你使用VB.NET 2008嗎? '也許Container.DataItem.rDate.isEmpty = TRUE'會有所幫助 –