I've gathered a bunch of data from Active Directory and placed it into a
datatable ("ADTable"). I now need to sort and filter this table based on
the selection of a drop down list("ddlCatego ry"). How can I filter the
dataview of this datatable to display those records that match (partially or
fully) the value selected in the drop down list?
I have the following code that doesn't work, and returns zero rows (note
that 'department' is a valid column name as I've tested dvCustom.RowFil ter
="department Like Information Management" and it works):
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSearch.Click
'Make a copy of the default dataview of the ADTable so it's refreshed to
original every time button is clicked.
Dim dvCustom As DataView = ADTable.Default View
dvCustom.RowFil ter = "department LIKE " & "'*" &
ddlCategory.Sel ectedItem.Text & "*'"
'cn is another column name, is valid and works.
dvCustom.Sort = "cn"
'DGADResults is simply a datagrid that displays the dataview
DGADResults.Dat aSource = dvCustom
DGADResults.Dat aBind()
End Sub
Any help would be greatly appreciated!
Thanks in advance,
Jason 1 1686
Thanks alot, that worked alot better than trying to create a custom filter
with wildcards, etc (which I did end up getting to work as well, but
disgarded for this simpler way).
Thanks again.
"vzaffiro" <vz******@discu ssions.microsof t.com> wrote in message
news:BA******** *************** ***********@mic rosoft.com... Hey jason,
I have done this thru a datatable using the following logic //Create the datatable from the dataset DataTable dt = Common.GetLooku pTable(table,we bpage);
//Foundrows is an array that will be returned from the select DataRow[] foundRows;
//Create the where clause string whereclause = string.Format(" cdstatus = {0} and cdstatus_apr_or d = {1}",cdStatus,c urrentOrder)
//Fill the array by filtering the data table foundRows = dt.Select(where clause);
Foundrows now has an array of datarows that you can traverse.
Here are some references: http://www.akadia.com/services/dotnet_filter_sort.html http://www.eggheadcafe.com/articles/20030903.asp
Good Luck!
"Jason" wrote:
I've gathered a bunch of data from Active Directory and placed it into a datatable ("ADTable"). I now need to sort and filter this table based
on the selection of a drop down list("ddlCatego ry"). How can I filter the dataview of this datatable to display those records that match
(partially or fully) the value selected in the drop down list?
I have the following code that doesn't work, and returns zero rows (note that 'department' is a valid column name as I've tested
dvCustom.RowFil ter ="department Like Information Management" and it works):
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSearch.Click
'Make a copy of the default dataview of the ADTable so it's
refreshed to original every time button is clicked.
Dim dvCustom As DataView = ADTable.Default View
dvCustom.RowFil ter = "department LIKE " & "'*" & ddlCategory.Sel ectedItem.Text & "*'" 'cn is another column name, is valid and works. dvCustom.Sort = "cn"
'DGADResults is simply a datagrid that displays the dataview
DGADResults.Dat aSource = dvCustom DGADResults.Dat aBind() End Sub
Any help would be greatly appreciated!
Thanks in advance,
Jason This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alex Ayzin |
last post by:
Hi,
I have a problem that might be easy to solve(possibly, I've just overlooked
an easy solution). Here we go:
I have a dataset with 2 datatables in it. Now, I need to do the following:
if ds.table(0).rows(0).item("col1") = ds.table(1).rows(0).item("col2") then
txtResult.text = ds.table(1).rows(0).item("col3")
|
by: Patrick |
last post by:
I'm working on a contact management application, and need a hand with one
aspect...
Here's what I want to create:
------------------------------------
A form split into two parts. There is a datagrid on the left side that lists
names and perhaps a couple of other key fields. The user can click on a
record in the datagrid, which should automatically pull up details on that
record in the various text boxes and other controls on the right...
|
by: Ubi |
last post by:
hi
i have a problem with System.Data.DataViewRowState.
i have a ReadOnly datagrid,
a dataView and a dataTable.
i'm using the dataView's filter property to filter the data (firstName =
'Dani').
the problem is that i don't understanh how the ViewRowState works:
i have an external form that changes the value of the dataTable.
|
by: Siegfried Heintze |
last post by:
I'm displaying information on job postings in various cities. For example,
might have a dozen jobs in Atlanta GA and I decide, at run time, that I
don't want to see them. How do I set my DataView to filter them out? I tried
but I don't understand the DataView.FilterState member function. Can someone
give me an example that works with a Datagrid and data set instead of a
console mode program?
Thanks,
Siegfried
|
by: John Wildes |
last post by:
Hello
I have a small program that I've created to generate accounting
statements out of our policy managment system.
The first part of the process is selecting the customer to create the
statement for. In this process the application queries the database,
returns a dataset of just customer names, and their customer code that
is displayed in a list. This results in something like 200 names.
| |
by: |
last post by:
Hello,
Does anyone have an idea on how I can filter the data in the gridview
control that was returned by an sql query?
I have a gridview that works fine when I populate it with data. Now I want
to look at that data and filter it based on what is in it.
I know that this could have been done with data sets and data views in
asp.net 1.1 but how is this done now in asp.net 2.0?
|
by: LDD |
last post by:
Hi Folks
I'm trying to determine a way to handle paging, filtering and sorting in a
datagrid.
If I choose to filter and sort, I'd like to return a subset. If that
resultset has more records then the number of rows I'd like to display, I'd
like to be able to load pages into the grid.
My question is, do I need to continually hit the db to get the next page of
records, or is there another method of doing with the dataset. i.e. load the
|
by: Anup Daware |
last post by:
Abstract: I want to filter a dataview with a value where column name
have a SPACE.
Description:-
I bind a dataview to a datagrid,
The query which is fetching the results in Dataset is something like
this:-
Select POSTAL_ADDRESS as "Postal Address" from Emp where ....
Now the column name in Dataview is "Postal Address" which is having a
space, with this column name when I am filtering the Dataview like:-
DataViewAddress.RowFilter = ...
|
by: Harry Haller |
last post by:
Hello, I want to implement a generic list which will be used to
display 7 columns in a GridView. One should be able to sort, filter
and page each of the 7 columns. Ideally the filter should be
implemented simultaneously for multiple columns - but the data need
only be sorted by a single column at a time. Sorting should be both
ascending and descending.
I'm currently using a DataView but it's far too slow, because there
are a large...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |