Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Using dataview and dataviewmanager
posted

Another approach for filtering data I used was the dataview, setting the rowfilter,  the ultragrid works well when I assign a dataview as the datasource of the ultragrid, it even shows the child rows too. The problem is that I want to filter also the childrows, so the next approach is to use the dataviewmanager. What i don't get is that when I assign the dataviewmanager as the datasource of the ultragrid, there is no result, no change at all, why is this? I don't get it, it should work, that's what dataviewmanager for or am I wrong here?

Any help will be appreciated, thx in advance. 

Parents
No Data
Reply
  • 975
    posted

    Your question is old, but maybe others will be asking, I did. I got started with this same effort with an article by Martin Zahn at this link:

    http://www.developerfusion.com/article/4703/filtering-and-sorting-in-adonet/4/

    I wanted to filter the contents of band[1] of a grid to show just rows within a date range:  (This is just test code so it doesn't do exactly that, but you'll get the idea)

    DataViewManager viewManager = new DataViewManager(MyDataset);

     

    // Loop through the DataViewSettings and set Sort

    // or Rowfilter for each Table individually

    String myTable;foreach (DataViewSetting myDVS in viewManager.DataViewSettings)

    {

    // Set Default Sort Order = Primary Key for all Tables

    myDVS.ApplyDefaultSort = true;

    // Set individual Sort and Rowfilter ...

    myTable = myDVS.Table.ToString();

    if (myTable == "DTRevExpBizSizeDetailOnly")

    {

    myDVS.RowFilter =
    "proj_start_date > '01/10/2007'";

     

    }

    }

    MyUltraGrid.DataSource = viewManager;

     

    Bill

Children
No Data