0

質問のリストが記載された表があります。プロパティの1つはですlargeText
NULLテキストボックスを非表示にすること
TRUEを意味しますMultiLineテキストボックス
FALSEを表示することを意味します単一行のテキストボックスを表示することを意味します。

これが私がやろうとしていることです

<asp:TextBox ID="tbxFreeResponse" runat="server"
             Visible='<%# Eval("largeText") != null %>'
             TextMode = '<%# (Eval("largeText") == (object)true) ?
                               TextBoxMode.SingleLine : 
                               TextBoxMode.MultiLine%>'/>

ただし、Eval("largeText") == (object)true常に評価されFALSEます。私は何が欠けていますか?(object)タイプの非互換性について不平を言うので、キャストが必要です。

4

1 に答える 1

0

Here's what did the trick for me, hopefully someone will find this useful.

<asp:TextBox ID="tbxFreeResponse" runat="server" 
             Visible='<%# Eval("largeText") != null %>'
             TextMode = '<%# (!(Eval("largeText") is DBNull) && (bool)Eval("largeText")) ? 
                             TextBoxMode.MultiLine :
                             TextBoxMode.SingleLine%>'/>
于 2012-10-26T12:43:17.410 に答える