TWebGridPanel Run time Create

how run time create TWebGridPanel add to TWebGridPanel1 .
I can add the button to WebGridPanel1

var pp : TWebButton;
WP : TWebGridPanel;

pp := TWebButton.Create(self);
pp.Caption := caption;
pp.Parent := WebGridPanel1 ;

// now create TWebGridPanel not add to WebGridPanel1

WP := TWebGridPanel.create(self) ;

WP.Parent := WebGridPanel1 ; // not Parent properties

When you create a TWebGridPanel in code, by default, it has zero columns, so to make it visible, you need to add columns (or rows) at least.

Sample code that shows this working:

var
  pp,sp: TWebButton;
  gp: TWebGridPanel;
begin
  pp := TWebButton.Create(self);
  pp.Caption := 'in main';
  WebGridPanel1.AddControl(pp);

  gp := TWebGridPanel.Create(Self);
  gp.ColumnCollection.Add;
  gp.ColumnCollection.Add;
  WebGridPanel1.AddControl(gp);

  sp := TWebButton.Create(self);
  sp.Caption := 'in sub';
  gp.AddControl(sp);

end;

Thanks for the reply, I still have a question
TMS WEB 1.9.8.3

Designtime
WebGridPanel1


Runtime Lost three labels ,But I'm happy that the project doesn't have this problem

Another problem is the added button wrong location
Runtime Add 4 button

var pp1,pp2,pp3,pp4 : TWebButton;
begin
pp1 := TWebButton.Create(self);
pp1.Caption := '1';
pp2 := TWebButton.Create(self);
pp2.Caption := '2';
pp3 := TWebButton.Create(self);
pp3.Caption := '3';
pp4 := TWebButton.Create(self);
pp4.Caption := '4';

WebGridPanel1.AddControl(pp1);
WebGridPanel1.AddControl(pp2);
WebGridPanel1.AddControl(pp3);
WebGridPanel1.AddControl(pp4);

end;

Runtime Lost three labels , Appear in show modal form,
first form doesn't have this problem

Cannot be reproduced with the latest version v2.0.2.2

Please test this first with the latest version.