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 3356756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:33:04+00:00 2026-05-18T02:33:04+00:00

I have an SqlDataSource in a page, which will display different results depending on

  • 0

I have an SqlDataSource in a page, which will display different results depending on 1 or 2 query strings, and/or a filter textbox.

Here is my SqlDataSource and filters:

  <asp:SqlDataSource ID="sdsAudits" runat="server" 
        ConnectionString="<%$ ConnectionStrings:constring %>" 
        SelectCommand="SELECT * FROM [Audit]" FilterExpression="source = {0} AND customer = {1} AND (itemID like '%{2}%' OR parentID like '%{2}%')">
        <FilterParameters>
        <asp:QueryStringParameter Name="source" QueryStringField="source" />
        <asp:QueryStringParameter Name="customer" QueryStringField="customer" />
        <asp:ControlParameter Name="txtFilter" ControlID="txtFilter" PropertyName="Text" />
        </FilterParameters>

But for some reason, the filtering for any of the 3 possible filters don’t work. I tried taking out the 2 query string filters, and leaving just the textbox filter, and it worked fine then – so I’m guessing my filter expression is wrong?

Any ideas guys? Remember all 3 filters could be ‘active’ at once, if they have the 2 query strings and have typed into the textbox, or they could be none at all, or of course anything in between.

  • 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-18T02:33:04+00:00Added an answer on May 18, 2026 at 2:33 am

    Filter is intended to work in DataSet mode – data is retrieved into memory, and then filtered. Not very efficient – much better to use parameters in the select command itself, like so:

    <asp:SqlDataSource ID="sdsAudits" runat="server" 
        ConnectionString="<%$ ConnectionStrings:constring %>" 
        SelectCommand="SELECT * FROM [Audit] where source = @source AND customer = @customer AND (itemID like '%' + @txtFilter + '%' OR parentID like '%'+@txtFilter+'%')">
        <SelectParameters>
          <asp:QueryStringParameter Name="source" QueryStringField="source" />
          <asp:QueryStringParameter Name="customer" QueryStringField="customer" />
          <asp:ControlParameter Name="txtFilter" ControlID="txtFilter" PropertyName="Text" />
        </SelectParameters>
    </asp:SqlDataSource>
    

    or just add

      DataSourceMode="DataSet"
    

    to your SqlDataSource tag

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

Sidebar

Related Questions

I have a DataList which is bound to a SqlDataSource, Ive got a LINQ
Hey guys, I have a GridView which is binded to SqlDataSource, everything works fine,
I have two dropdownlist, a detailsview and a formview control in my page. The
I have two search buttons on a page, one linked to a dropdown list
In ObjectDataSource we have a method called SelectMethod and TypeName in which we can
Let's say, I have a 2 TextBox, a button, and a DataSource. This is
I have a dropdownlist, whose datasource is from SQL server. <asp:DropDownList ID=State runat=server DataSourceID=SqlDataSource1
I am using SqlDataSource to pull in information from a table such that only
I want to have a chart on each row of a data grid, being
i am a beginner in making website, i learned things at msdn only, but

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.