Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Deleting datagrid rows depending on cloumn data

Posted on 2004-09-09
6
Medium Priority
?
226 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
3 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2

876 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