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
250
How to Get Object corresponding to a specific row when a collection of object is bound to the grid ?
posted

I have a collection of custom object bound to a grid through a DataSource.

The type of the objects is BusinessBase.

I added an unbound column (Key : SEL) with a bool value.

I want to be able to retrieve each BusinessBase object corresponding to the rows where  SEL = true.

Anyone can provide a sample on how to accomplish this ?

Thanks.

 

 

Parents
  • 37774
    Verified Answer
    posted

    You would just have to loop through all the rows in the grid and check this condition, then look at the ListObject of the row, i.e.:

     foreach (UltraGridRow row in this.ultraGrid1.Rows)
    {
        if ((bool)row.Cells["SEL"].Value)
        {
            BusinessBase businessObject = (BusinessBase)row.ListObject;
            
            // Do stuff
        }
    }

    -Matt

Reply Children
No Data