Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Odd behavior with grid controls created at runtime
#3
Hi Paul,

this modified example is working as it should. Please have a look:


.zip   GridControls.zip (Size: 54.84 KB / Downloads: 5)

The issue is: Whenever you create controls at runtime, always set the parent of the control. In the case of the grid, skipping this step works when rendering in a full post back (sync event) because of a "peculiarity" of the grid rendering mechanism when it has child controls. But it won't work in an async event. It won't work for any other parent either (i.e. if you create a IWCheckBox owned by the form and forget to make it the parent, it won't be visible, similar to what would happen in a desktop VCL application).

As a rule of thumb: whenever creating a control at runtime, first thing you do: set the parent.

If you don't mind I'd like to add this project of yours to our demo repository. It is a nice example on how to create such a grid  Smile

Cheers,
Reply


Messages In This Thread
RE: Odd behavior with grid controls created at runtime - by Alexandre Machado - 07-12-2023, 01:32 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)