1

ASP.NET 4 で C# を使用しています。

GridView と、それを DataBase にバインドするための EntityDataSource があります。

ソース DB テーブルには Bool 列(0,1) が含まれています。

RadioList ボタンなどを使用して、GridView で結果をフィルター処理したいと思います。

WhereParameters をエンティティ セットに追加すると、エラーが発生します。

String was not recognized as a valid Boolean. 

それを解決する方法はありますか?ありがとう

    <WhereParameters>
        <asp:ControlParameter ControlID="uxFilterMessageTypeSelector" 
            Name="TypeMessage" PropertyName="SelectedValue" Type="String" />
        <asp:ControlParameter ControlID="uxFilterIsReplied" Name="IsReplied" 
            PropertyName="SelectedValue" DbType="Boolean" />
    </WhereParameters>

    <asp:RadioButtonList ID="uxFilterIsReplied" runat="server" AutoPostBack="True">
        <asp:ListItem Value="Y">1</asp:ListItem>
        <asp:ListItem Value="F">0</asp:ListItem>
    </asp:RadioButtonList>
4

1 に答える 1

2

RadioButtonList を次のように変更します。

<asp:RadioButtonList ID="uxFilterIsReplied" runat="server" AutoPostBack="True">
    <asp:ListItem Value="True">1</asp:ListItem>
    <asp:ListItem Value="False">0</asp:ListItem>
</asp:RadioButtonList>

次に、文字列は認識されるブール値になります。

于 2011-02-09T16:35:14.597 に答える