Reputation: 4432
I have an Entity I'm pulling three columns from Title (nvarchar(256)), Popularity (int), and Type (int). I'm then trying to use QueryExtender on a radiobuttonlist to allow the end user to filter out all but specific results but I keep getting an "Argument Types do not match" error. Here is the actual code:
<asp:QueryExtender ID="QueryExtender1" runat="server" TargetControlID="EntityDataSource1">
<asp:SearchExpression DataFields="Type" SearchType="StartsWith">
<asp:ControlParameter ControlID="rblTypes" PropertyName="SelectedValue" />
</asp:SearchExpression>
</asp:QueryExtender>
<asp:RadioButtonList ID="rblTypes" runat="server" AutoPostBack="True"
RepeatColumns="5" RepeatDirection="Horizontal">
<asp:ListItem Value="1">Active Inside</asp:ListItem>
<asp:ListItem Value="2">Semi-Active Inside</asp:ListItem>
<asp:ListItem Value="3">Inactive Inside</asp:ListItem>
<asp:ListItem Value="4">Chair Game</asp:ListItem>
<asp:ListItem Value="5">Active Outside</asp:ListItem>
<asp:ListItem Value="6">Semi-Active Outside</asp:ListItem>
<asp:ListItem Value="7">Inactive Outside</asp:ListItem>
<asp:ListItem Value="8">Water Game</asp:ListItem>
<asp:ListItem Value="9">Messy Game</asp:ListItem>
<asp:ListItem Value="10">Trick</asp:ListItem>
</asp:RadioButtonList>
Any suggestions?
Upvotes: 1
Views: 1706
Reputation: 177163
Just a guess: SelectedValue
is a string
. It doesn't match with Type
which is an int
. You could try to specify the DbType
explicitely in the ControlParameter
:
<asp:ControlParameter ControlID="rblTypes" PropertyName="SelectedValue"
DbType="Int32" />
Edit
asp:SearchExpression
seems only to be for text based search which means that the data fields you specify must be of type string
which is not the case for your Type
column. Instead of a SearchExpression you could try an asp:RangeExpression
and specify the same value for minimum and maximum, namely the SelectedValue
of the RadioButtonList:
<asp:QueryExtender ID="QueryExtender1" runat="server"
TargetControlID="EntityDataSource1">
<asp:RangeExpression DataField="Type" MinType="Inclusive" MaxType="Inclusive">
<asp:ControlParameter ControlID="rblTypes" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="rblTypes" PropertyName="SelectedValue" />
</asp:SearchExpression>
</asp:QueryExtender>
Upvotes: 3