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

  • Home
  • SEARCH
  • 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 6246031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:36:55+00:00 2026-05-24T12:36:55+00:00

I am using a GridView and I require the user to be able to

  • 0

I am using a GridView and I require the user to be able to filter using 2 controls. One simply filters the type of row – there is a column called action, and the user selects one of the distinct values from the database in a dropdown box, and the gridview only displays the rows with that value in the action column. On it’s own this works perfect.

But I am also adding a textbox where the user can type in an ID of either the ‘itemID’, or the ‘parentID’. This works fine even with the previous control.

Problem is, the dropdown box does not work when the textbox is empty (i.e. all ID’s are being shown). If I choose a value and click Submit, it just doesn’t do anything. Now if I am filtering by ID and then choose a value from the dropdown box, it works perfect.

Here is my filter expression and parameters of the datasource:

      <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="cleared for privacy"
        SelectCommand="SELECT * FROM [Audit] WHERE ([source] = @source)" FilterExpression="action like '{0}%' and (itemID like '{1}' or parentID like '{1}')">
        <SelectParameters>
            <asp:Parameter DefaultValue="LOGISTICS" Name="source" Type="String" />
        </SelectParameters>
        <FilterParameters>
            <asp:ControlParameter Name="action" ControlID="DropDownList1" PropertyName="SelectedValue" />
            <asp:ControlParameter Name="legorinvid" ControlID="txtFilter" PropertyName="Text" />
        </FilterParameters>
    </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-24T12:36:56+00:00Added an answer on May 24, 2026 at 12:36 pm

    You need to set ConvertEmptyStringToNull property of ControlParameter in FilterParameters to false.

    This ensures the gridview shows all data when no text in all filter text boxes

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

Sidebar

Related Questions

I am creating a calendar using GridView (6 row * 8 column). Each of
I am using GridView in my application for populating datas. Is there any easy
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
What I want is a central column using GridView, but everything I try does
I am using Gridview and using Item Template text box. There are 5 text
I am using Gridview with Edit option. When i click on Edit button row
I'm using GridView with a HyperLink column, and I want to do the following:
I have been using Gridview to display data.i set the width of each column
I am using gridView. I have 4 auto generated columns and 1 generated by
Hi i m using GridView with hovermenu and i want that when we click

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.