How to Generate group control at run time in dynamics axapta

To Generate dynamics axapta group control at run time in axapta you can try following code. Group is nothing but its one type of control like frame. In that group you can create other control like stringedit,date,enum and extended data types.

In group you can set caption,name ,width,height, left,right etc properties .



 str groupMarkup = ' ';  
 str fieldsMarkup = ' ';  
 str label;  
 str caption;  
 str name;  
 // only generate a group if in a form and not already in a grid  
 if (_inAxFormControl && !_inGridControl && !_inAxGroupControl)  
 {  
 if (controlNode)  
 {  
 name = controlNode.AOTname();  
 label = controlNode.AOTgetProperty('Caption');  
 }  
 if (label != '')  
 {  
 caption = 'Caption="' + this.generateLabelMarkup(label) + '"';  
 }  
 _markup.appendText(strfmt(groupMarkup, name, this.getNextId(), caption));  
 _markup.appendText('\r\n');  
 _markup.appendText(fieldsMarkup);  
 _markup.appendText('\r\n');  
 _inAxGroupControl = true;  
 }