473,378 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Row Filtering in dataset

I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?

I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??

Thanks.

Oct 3 '06 #1
5 1630
Maybe try setting the SqlDataSource.FilterExpression property?
http://msdn2.microsoft.com/en-us/lib...xpression.aspx

DBC User wrote:
I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?

I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??

Thanks.
Oct 3 '06 #2
The original input is XML that I convert to DataSource. Any
suggestions?
Thanks.
Chris Fulstow wrote:
Maybe try setting the SqlDataSource.FilterExpression property?
http://msdn2.microsoft.com/en-us/lib...xpression.aspx

DBC User wrote:
I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?

I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??

Thanks.
Oct 3 '06 #3
Ahhh, ok...
Maybe try setting the XmlDataSource.XPath property?
http://msdn2.microsoft.com/en-us/lib...rce.xpath.aspx

DBC User wrote:
The original input is XML that I convert to DataSource. Any
suggestions?
Thanks.
Chris Fulstow wrote:
Maybe try setting the SqlDataSource.FilterExpression property?
http://msdn2.microsoft.com/en-us/lib...xpression.aspx

DBC User wrote:
I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?
>
I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??
>
Thanks.
Oct 3 '06 #4
Hi,

You can bind the grid to a DataView:

DataView view = new DataView(myDataTable);

// the following code does not modify the underlying DataTable
// it only provides a logical "view" of the data to which you can bind the grid
view.RowFilter = "Column1 = 'a value.'";

// Although we're assigning the DataView as the source and not the DataTable,
// you can still configure the grid in exactly the same way as you would for your DataTable.
// i.e. You can use the same column names for binding.
// (Internally, most framework controls switch to a DataView anyway when binding to a DataTable, AFAIK.)
grid.DataSource = view;

The following link describes the expression syntax that you can use for the RowFilter property and other DataSet expressions:

DataColumn.Expression property on MSDN:
http://msdn2.microsoft.com/en-us/lib...xpression.aspx

--
Dave Sexton

"DBC User" <db*****@gmail.comwrote in message news:11**********************@k70g2000cwa.googlegr oups.com...
>I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?

I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??

Thanks.

Oct 3 '06 #5
DBC,

There is nothing wrong with looping through the table and to remove the
datarows you do not want
If it is not a database related table, than it is not important if you use
delete or remove.

Cor

"DBC User" <db*****@gmail.comschreef in bericht
news:11**********************@k70g2000cwa.googlegr oups.com...
>I have a data set which has a data table. This dataset is set as a
datasource for a display grid. Before I assign the data set to data
grid, I would like to elliminate some rows from the data table. How can
I do this?

I saw an example where I can identify the table and then apply the
select on the table. Which returns the data rows. Is there a way I can
remove the rows without doing this 2 step process of obtaining the data
row and then put the data row back in the table etc.,??

Thanks.

Oct 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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...
3
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format...
0
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...
0
by: Jenny C. | last post by:
Hi I am trying to do a SUM on a DataSet column with the following code // ds is the DataSet that I need to calculate data fro String filter2 = "EmpNo = " + this.EmpNo + " AND WEEK_ENDING >= '"...
2
by: Marco Ippolito | last post by:
I have an offline DataSet: id (PK, sorted ASC), firstname, enabled 1, Aaron, true 2, Bill, false 3, Charlie, true .... 10001, Mike, false 10002, Nathan, false
0
by: ber.janssens | last post by:
Hi, I am trying the new ObjectDataSource from ASP.NET 2.0. I connected a Gridview with ObjectDataSource which is connected to a webservice which returns a DataSet. In the Webmethod I return...
7
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...
5
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...
2
by: Jason Huang | last post by:
Hi, I use the ReadXML method in my C# Windows Form project. Here is some of my C# code: xmlDS.ReadXml(curDir + "\\Dept.xml") ; There're 20 rows and 5 columns in the Dept.xml. But now I just...
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.