Search code examples
objectlistview

How to disable specify rows in objectlistview


There

I want to disable some rows in objectlistview (Ver. 2.9)

Code:

private void olvPatientstockedOrders_FormatRow(object sender, FormatRowEventArgs e)
    {           
        CServerOrder order = (CServerOrder)e.Model;          
        if(order.OrderControl.ToUpper().Contains("DC"))
        {
            olvPatientstockedOrders.DisableObject(e.Model);        
        }     
    }

But I get exceptions on code "olvPatientstockedOrders.DisableObject(e.Model); and there is no details info

enter image description here


Solution

  • DisableObject() internally calls FormatRow (since DisableObject() potentially changes the look/format of the row), so it is stuck in an endless loop and causing a StackOverflowException (like the exception dialog suggests).