开发者

How to filter a grid view with a RadioBUttonList and Where Clausole

I use C# in ASP.NET 4.

I have a GridView and an EntityDataSource for binding it with the DataBase.

Source DB Table contains a Bool Column (0,1).

I would like to filter the result in the GridView using a RadioList button or similar.

Adding the WhereParameters to the Entity Set I get an error:

String was not rec开发者_JAVA百科ognized as a valid Boolean. 

Any idea how to solve it? Thanks

    <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>


Change your RadioButtonList to the following:

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

Then the String will be a recognized Boolean value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜