I have a DropDownList with values that I get from a SQL database. Depending on the selection made from the DropDownList, I populate a GridView, also from a SQL database.
When I set AutoPostBack=true on the DropDownList I get a ‘Input string not in correct format’ error.
My DropDownList:
<html>
<asp:DropDownList ID="ddlClient" runat="server" DataSourceID="dsClientList" AppendDataBoundItems="True" DataTextField="Name" DataValueField="Name" TabIndex="0" Font-Names="Verdana" Font-Size="11px" ForeColor="#2D2D2D" AutoPostBack="true">
<asp:ListItem Value="">--- Select ---</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="dsClientList" runat="server" SelectMethod="GetList" TypeName="Class.Client">
</asp:ObjectDataSource>
</html>
In my ObjectDataSource for my GridView I use the following SelectParameters:
<SelectParameters>
<asp:ControlParameter ControlID="ddlClient" Name="pClientID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
Any help?
Thanks
You have to set numeric column for
DataValueField="Name".May be anIDorNumber.