Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 978641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:05:18+00:00 2026-05-16T04:05:18+00:00

I have a ASP.Net web page with a grid view. I want to filter

  • 0

I have a ASP.Net web page with a grid view. I want to filter the grid view data based on the selection of a drop down list. I have this working fine on another page. The difference on the problem page is that the column I need to filter against is an int rather than a varchar. When I load the page I get the error message: Input string was not in a correct format.

I have pasted code for the dropdownlist and datasource below. This must be a common requirement so I guess I’m missing something obvious…? On attempting to find a resolution via Google, other have the same problem. A post on very similar lines can be found at http://www.velocityreviews.com/forums/t123088-problem-in-filterparameters.html, unfortunately Gavin’s resolution didn’t work for me.

Many thanks,

Rob.

<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="BacheAccountSettings.aspx.cs"
Inherits="RDM.BacheTradeLoad" Title="Untitled Page" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<tr>
    <td style="width: 100px;">
        Filter:
    </td>
    <td style="width: 170px;">
        <asp:DropDownList ID="ddlAccountSourceId" DataSourceID="dsAccountSourceId" AutoPostBack="true"
            DataValueField="AccountId" runat="server" Width="130px" Font-Size="11px" AppendDataBoundItems="true">
            <asp:ListItem Text="All" Value="%"></asp:ListItem>
        </asp:DropDownList>
    </td>
</tr>
<tr>
    <td colspan="1">
        <asp:GridView ID="grdRefBacheAccount" runat="server" AutoGenerateColumns="False"
            BackColor="White" BorderColor="#E7E7FF" BorderWidth="1px" CellPadding="3" DataSourceID="dsArcReference"
            GridLines="Horizontal" BorderStyle="None" EnableModelValidation="True" Style="position: static"
            OnRowDataBound="grdRefBacheAccount_RowDataBound" AllowPaging="True" PageSize="25"
            CssClass="Grid" AllowSorting="True">
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowCancelButton="False" />
                <asp:BoundField DataField="SourceID" HeaderText="SourceID" SortExpression="SourceID" />
                <asp:BoundField DataField="GroupCompany" HeaderText="GroupCompany" SortExpression="GroupCompany" />
                <asp:BoundField DataField="Portfolio" HeaderText="Portfolio" SortExpression="Portfolio" />
                <asp:BoundField DataField="OnBehalfComp" HeaderText="OnBehalfComp" SortExpression="OnBehalfComp" />
                <asp:BoundField DataField="AssignedTrader" HeaderText="AssignedTrader" SortExpression="AssignedTrader" />
            </Columns>
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
            <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
            <SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" Font-Bold="True" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <AlternatingRowStyle BackColor="#F7F7F7" />
        </asp:GridView>
    </td>
</tr>
<div id="divImportButton" align="right">
    <asp:Button ID="btnImport" runat="server" Text="Import Trade" OnClick="btnImport_Click"
        CssClass="Button" />
</div>
<asp:SqlDataSource ID="dsArcReference" runat="server" ConnectionString="<%$ ConnectionStrings:ARC_REFERENCEConnectionString %>"
    SelectCommand="select ACCOUNT_SOURCE_ID as 'AccountId',
                    [ACCOUNT_BTF_GROUP_COMPANY] as 'GroupCompany',
                    [ACCOUNT_BTF_PORTFOLIO] as 'Portfolio',
                    [ACCOUNT_BTF_ON_BEHALF_COMPANY] as 'OnBehalfComp',
                    [ACCOUNT_BTF_ASSIGNED_TRADER] as 'AssignedTrader'
                    from dbo.REF_BACHE_ACCOUNT" UpdateCommand="update dbo.REF_BACHE_ACCOUNT
                set [ACCOUNT_BTF_GROUP_COMPANY] = @GroupCompany,
                [ACCOUNT_BTF_PORTFOLIO] = @Portfolio,
                [ACCOUNT_BTF_ON_BEHALF_COMPANY] = @OnBehalfComp,
                [ACCOUNT_BTF_ASSIGNED_TRADER] = @AssignedTrader
                where [ACCOUNT_SOURCE_ID]=@SourceID" FilterExpression="SourceID={0}">
    <FilterParameters>
        <asp:ControlParameter Type="Int32" ControlID="ddlAccountSourceId" PropertyName="SelectedValue" />
    </FilterParameters>
    <UpdateParameters>
        <asp:Parameter />
        <asp:Parameter Name="ACCOUNT_SOURCE_ID" />
    </UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsAccountSourceId" runat="server" ConnectionString="<%$ ConnectionStrings:ARC_REFERENCEConnectionString %>"
    SelectCommand="SELECT DISTINCT [ACCOUNT_SOURCE_ID] as AccountId FROM [REF_BACHE_ACCOUNT]"
    DataSourceMode="DataSet"></asp:SqlDataSource>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:05:19+00:00Added an answer on May 16, 2026 at 4:05 am

    You pass a value that is not Int32.

     <asp:ListItem Text="All" Value="%"></asp:ListItem>
    

    Remove this line and its going to work. For show them all you need to find an other way…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a grid view in an asp.net web page, where I am
I have a normal gridview on asp.net web page... I want to select a
I have a GridView and want to on an ASP.NET Web Application page and
I have an ASP.NET web page(Not MVC ) (HomePage.aspx) and another page (PRiceList.aspx).I have
I have an ASP.Net web page, which uses a Master Page template. The page
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have an asp.net web page (C# 2008) where the user would enter an
On an ASP.NET web page I have an EntityDataSource: <asp:EntityDataSource ID=EntityDataSourceOrders runat=server ConnectionString=name=EntitiesContext DefaultContainerName=EntitiesContext
I have to do a asp.net web page that when load will say something
I have a standard ASP.NET 2.0 web page with a Delete button on it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.