locked
How do I obtain reference to current DataRow from binding? RRS feed

  • Question

  •  

    I am trying to make some business rule classes that are part of a collection and sit independent of any datasource, and currently I am making a front end for them that handles datatables.  The question is... is there a way for me to obtain a reference to the current datarow from one of the many binding objects in a binding system.  This way the client programmer will not have to pass a DataRow to me and call "EvaluateRules()", rather I can find out what the current DataRow, or DataRows (in a DataSet) are and go from there.

     

     

    Thursday, April 20, 2006 3:20 PM

Answers

  • If, for examplo you have a "customersBindingSource" than
    you can write:

    DataRowView dview = (DataRowView) customersBindingSource.Current;
    if(dview!=null)
        DataRow row = dview.Row;
    else
       return null;


    Sunday, April 23, 2006 10:37 PM

All replies

  • Check the Current property of a BindingManagerBase class.

    Thursday, April 20, 2006 9:30 PM
  • If, for examplo you have a "customersBindingSource" than
    you can write:

    DataRowView dview = (DataRowView) customersBindingSource.Current;
    if(dview!=null)
        DataRow row = dview.Row;
    else
       return null;


    Sunday, April 23, 2006 10:37 PM