question

ITResearcher-2061 avatar image
0 Votes"
ITResearcher-2061 asked ITResearcher-2061 answered

ActiveX grid control in asp.net

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 ?




dotnet-aspnet-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I would try and bit the bullet here, and re-build using listview (or grid view - but lv is unlimited in terms of flexibility). Now, no question you given this thought, and want to save lots of time.

But, I would not try and put that round peg in a square hole so to speak.

And nice laid out grids with lots of features and good looking can take a LOT of work (I get your goal here).

But, I think over time, the efforts are/will be worth it to re-build the grid with a non ActiveX control - I really do think that is the best road. (but will take work!).

I feel bad, since i don't have better advice then a re-build of the grid using a native asp.net control.

0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ITResearcher-2061 avatar image
0 Votes"
ITResearcher-2061 answered

solved after registering latest OCX in webserver

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.