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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:09:46+00:00 2026-05-11T16:09:46+00:00

Meh! Can’t understand what happens here. The filter is correctly applied when used on

  • 0

Meh! Can’t understand what happens here.

The filter is correctly applied when used on SqlDataSource1, to correctly populate the corresponding gridview.

That being said, the filtering isn’t applied on the manual select that I use to get a DataView, for the database insertion part.

What am I doing wrong? Is there something going on that I’m not aware of?

SqlDataSource1.FilterExpression = (string)ViewState["filtre"];

    cmdApply.Text = (string)ViewState["filtre"];

    DataView thingie =     (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

    thingie.RowFilter = (string)ViewState["filtre"];

    DataView verifdv =     (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

    verifdv.Sort = "filterClient";

    SqlConnection dbconn = new SqlConnection(SqlDataSource1.ConnectionString);        

    foreach ( DataRow dr in thingie.Table.Rows ) {

        if ( verifdv.Find(dr["orgID"]) == -1 ) {

        SqlCommand addFilter = new SqlCommand("INSERT INTO dbo.usermetafilter     (filterUser, filterClient) VALUES (@user, @client)", dbconn);

                addFilter.Parameters.Add("@user", SqlDbType.NVarChar).Value = "dummyvalue";

                addFilter.Parameters.Add("@client", SqlDbType.Int).Value = dr["orgID"];

                addFilter.Connection.Open();

                addFilter.ExecuteNonQuery();

                addFilter.Connection.Close();

            }

        }
  • 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-11T16:09:46+00:00Added an answer on May 11, 2026 at 4:09 pm

    Nevermind. The correct code should have been:

    foreach ( DataRow dr in thingie.Table.Select((string)ViewState["filtre"];
    

    ) ) {

    The Select method for the datasource doesn’t use the filter in the DS’ FilterExpression property. It gets the whole thing. On the other hand, the DataView.Table.Select(String FilterExpression) returns an array of all its rows, filtered. How cool is that, I solved my own problem.

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

Sidebar

Related Questions

I have a function irc_sendline that can be called like printf can irc_sendline(s, A
Here's the abstract situation: I have CoreData objects 'car' and 'review'.'review' can be 'good','bad'
This is so simple that I can't believe it caught me. def meth(id, options
having an issue supporting IE6 (meh).. I have an update panel that is triggered
<?php $foo = 1; function meh(){ // <-- $foo can't be accessed } It
This is my first post here and I'm fairly desperate. My issue is that
Suppose we got a code like this: IEnumerable<Foo> A = meh(); IEnumerable<Foo> B =
Alright, probably not the best title, but meh. I have the following code inside
OK so I redefined my last program... here it is: import java.io.BufferedReader; import java.io.InputStreamReader;
<ul> <li><a href=#>meh</a></li> <li><a class=target>aha!</a></li> </ul> This CSS would hopefully allow aha! to change

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.