Solved

Deleting datagrid rows depending on cloumn data

Posted on 2004-09-09
6
218 Views
Last Modified: 2010-04-23
Hi,

I want to know how to delete certain rows from the datagrid depending on the column data. Like I have a column named Status. Under status I have data as "Available", "Unavailable". When I display the data, I want to select only "Available" and delete the rows which has "Unavailable" data at Status column. I am displaying the data from an XML file. Please let me know how I can get this done.

Reddy
0
Comment
Question by:angireddy
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Javert93
ID: 12021661
How are you loading the XML file into the datagrid (Manually or through Data Binding)?
0
 

Author Comment

by:angireddy
ID: 12021711
Dim dsData As New DataSet()
filepath = "QCWorkQueue.xml"
dsData.ReadXml(filepath)
With dgData
      .DataSource = dsData
      .DataMember = "ProsWorkItem"
      .AllowSorting = True
End With
0
 
LVL 4

Accepted Solution

by:
Javert93 earned 500 total points
ID: 12021809
Oh, you are storing the data in a DataSet that is persisted to disk. In that case, you can use a DataView to "filter" the DataSet and only expose the records that meet a certain criteria, like this:

        Dim dsData As New DataSet()
        dsData.ReadXml("QCWorkQueue.xml")

        Dim dvData As New DataView(dsData.Tables("ProsWorkItem"))
        dvData.RowFilter = "column_name = 'Available'"

        With dgData
            .DataSource = dvData
            .DataMember = "ProsWorkItem"
            .AllowSorting = True
        End With

Please note that I am assuming that the name of your table is "ProsWorkItem." Also, be sure to replace "column_name" with the name of your status column.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now