0

I have a DataSet which will be filtered twice like the following. How can I set the RowFilter property of the DataView twice? Or is there any other better implementation than the one below?

DataView dv = new DataView(myDataSet.Tables[0]);
dv.RowFilter = "approved = 1";
dv.Sort = "BookingDate";
foreach row{
    //Filter by shiftTime in filtered DataView
    foreach column{
        //Find date in filtered DataView
    }
}

Thank you in advance for your help.

Thanks, artsylar

artsylar
  • 2,648
  • 4
  • 34
  • 51

1 Answers1

0

I don't know if you've already found the solution. I assume you have but I will still post a possible solution if it helps someone. It's in VB.NET though.

Dim dv_docs As New DataView(ds_allDocsInfo.Tables(0))
Dim rowFilter As String = ""
rowFilter = "DocumentStatus='Published' And templateFrameID='2'
dv_docs.RowFilter = rowFilter
DLDocument.DataSource = dv_docs
DLDocument.DataBind()

Note: To have multiple filters I have used 'And' and built a row filter separately before applying it to the DataView.

Hope this helps.

Pratul Sanwal
  • 544
  • 7
  • 9