We are trying use ActiveX component grid control in asp.net server side code(hidden grid).
From asp.net code we are instantiating a class (from class library - dll reference) , in which a windows form is loaded from a thread (ApartmentState set to ApartmentState.STA)
We are getting following error while reading ActiveX control '.rows' property:
Property get of 'Rows' cannot be invoked at this time. Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.
'.name' property was returning proper value.
Same error is thrown to dynamic grid also, outside windows form.
Dim a As New grid1
a.Rows = 5
Also, same code is working from the IDE(localhost) without error.
Is there any setting, to be done in asp.net project ?