ActiveX grid control in asp.net

IT Researcher 26 Reputation points
2021-10-20T09:21:09.067+00:00

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.CreateControl()
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 ?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2021-10-20T14:40:45.897+00:00

    When run with the ide, there is an active window for the control (the one running the ide). When run with iis, which is a service, there is no window, and window controls will not work.

    0 comments No comments

  2. IT Researcher 26 Reputation points
    2021-10-21T09:16:10.78+00:00

    solved after registering latest OCX in webserver

    0 comments No comments