Dataview filtering problem

  • Thread starter vallabh naidu via .NET 247
  • Start date
V

vallabh naidu via .NET 247

(Type your message here)

--------------------------------
From: vallabh naidu

Hi everyone,

I have a typical problem, I dont weather what i am writing iscorrect or not but I just want to filter the dataview and heregoes the code but that code below is not filtering according tothe condition... eagarly waiting for a positive result from anyof you people.

Dim myfilter As String = "Parent_Org ='" & e.Node.Tag &"'"
Dim DVOrg As New DataView(dt, myfilter, "ORG_Cd",DataViewRowState.ModifiedCurrent)

Dim dr As DataRow

Dim SelNode As TreeNode = e.Node

If DVOrg.Table.Rows.Count > 1 Then
For Each dr In DVOrg.Table.Rows
Dim Nd As New TreeNode
Nd.Text = dr("ORG_Cd") + " " + dr("UDOrg_cd") + "" + dr("ORG_DESC")
Nd.Tag = dr("ORG_Cd")
SelNode.Nodes.Add(Nd)
Next
End If
 
C

Cor Ligthert

Vallabh,

I miss to much to see what you are up to, however I saw that you was using
this.
For Each dr In DVOrg.Table.Rows

This is looping through the original Table from the dataview.
Probably you need the datarowview for what you are up to.
http://msdn.microsoft.com/library/d...html/frlrfsystemdatadatarowviewclasstopic.asp

And than using of course something as
For Each drv as datarowview in DVOrg


I hope this helps,

Cor





"vallabh naidu via .NET 247" <[email protected]> schreef in bericht
(Type your message here)

--------------------------------
From: vallabh naidu

Hi everyone,

I have a typical problem, I dont weather what i am writing is correct or not
but I just want to filter the dataview and here goes the code but that code
below is not filtering according to the condition... eagarly waiting for a
positive result from any of you people.

Dim myfilter As String = "Parent_Org ='" & e.Node.Tag & "'"
Dim DVOrg As New DataView(dt, myfilter, "ORG_Cd",
DataViewRowState.ModifiedCurrent)

Dim dr As DataRow

Dim SelNode As TreeNode = e.Node

If DVOrg.Table.Rows.Count > 1 Then
For Each dr In DVOrg.Table.Rows
Dim Nd As New TreeNode
Nd.Text = dr("ORG_Cd") + " " + dr("UDOrg_cd") + " " +
dr("ORG_DESC")
Nd.Tag = dr("ORG_Cd")
SelNode.Nodes.Add(Nd)
Next
End If
 
S

Sahil Malik [MVP]

Filter the dataview? I am not sure what are you trying to acheive in the
following code !!??

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/


(Type your message here)

--------------------------------
From: vallabh naidu

Hi everyone,

I have a typical problem, I dont weather what i am writing is correct or not
but I just want to filter the dataview and here goes the code but that code
below is not filtering according to the condition... eagarly waiting for a
positive result from any of you people.

Dim myfilter As String = "Parent_Org ='" & e.Node.Tag & "'"
Dim DVOrg As New DataView(dt, myfilter, "ORG_Cd",
DataViewRowState.ModifiedCurrent)

Dim dr As DataRow

Dim SelNode As TreeNode = e.Node

If DVOrg.Table.Rows.Count > 1 Then
For Each dr In DVOrg.Table.Rows
Dim Nd As New TreeNode
Nd.Text = dr("ORG_Cd") + " " + dr("UDOrg_cd") + " " +
dr("ORG_DESC")
Nd.Tag = dr("ORG_Cd")
SelNode.Nodes.Add(Nd)
Next
End If
 
Top