Solved

Deleting datagrid rows depending on cloumn data

Posted on 2004-09-09
6
217 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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