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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:33:57+00:00 2026-06-02T01:33:57+00:00

I’m playing with optimization in ASP.Net WebForms. in my case I have 2 dropdowns

  • 0

I’m playing with optimization in ASP.Net WebForms.

in my case I have 2 dropdowns and a grid.

I want the dropdowns to act as a filter for the grid, each containing a distinct list of the data in one column of the grid (to use as a filter)

That’s fine.. I got it working, but I can’t use the same datasource as the grid for the dropdowns anymore because I’m applying a filterexpression to the datasource to filter whats in the grid.

since its the same datasource as the dropdowns, I get a smaller distinct list in the dropdown.

now I can use multiple datasources, each consuming the same data object, but I see in Sql Profiler that 2 data calls are made, but I’d really like to use the same one so I can have a single data call.

is it even possible to have a single ObjectDataSource be filtered for the grid, and at the same time and provide unfiltered data for another control?

  • 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-06-02T01:34:00+00:00Added an answer on June 2, 2026 at 1:34 am

    If you’re focused on not having to make multiple SQL calls, one option would be to use LINQ to query your DataSet in your SelectMethod. There may be a more elegant way to do this syntactically (I couldn’t figure one out) but this should provide your desired functionality using a single ObjectDataSource.

    If your ObjectDataSource declaration looks like:

    <asp:ObjectDataSource ID="myObjectDataSource" runat="server" SelectMethod="myObjectDataSource_Select" OnFiltering="myObjectDataSource_Filtering">
    

    In your SelectMethod you could do something like:

    public DataSet myObjectDataSource_Select()
    {
       string sqlQuery = "SELECT col1, col2, col3 FROM foo";
       SqlDataAdapter da = new SqlDataAdapter(sqlQuery, myConnectionString);
       DataSet ds = new DataSet();
       using (da) {
            da.Fill(ds);
       }
    
       //Perform your secondary filtering here
       object [] unfilteredQuery= (from r in ds.Tables[0].AsEnumerable()
            select r.Field<string>(“col1”)).ToArray();
       myUnfilteredComboBox.Items.Clear();
       myUnfilteredComboBox.Items.AddRange(unfilteredQuery);
    
       return ds;    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported

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.