Create Runtime form control and get the value in Ax 2012

public void init()
{
super();
element.addControlAtRuntime();
}

private void addControlAtRuntime()
{
FormButtonControl formButtonControl;
FormComboBoxControl formComboBoxControl;
formButtonControl = this.design().addControl(FormControlType::Button, “DynamicButtonControl”);
formButtonControl.text(“Dynamic Button Control”);
this.controlMethodOverload(true);
formComboBoxControl=this.design().addControl(FormControlType::ComboBox,”JKCombobox”);
formComboBoxControl.items(3);
formComboBoxControl.item(1);
formComboBoxControl.text(“John”);
formComboBoxControl.item(2);
formComboBoxControl.text(“Krish”);
formComboBoxControl.item(3);
formComboBoxControl.text(“The Great”);
this.controlMethodOverload(true);

}

void DynamicButtonControl_Clicked(FormButtonControl _formButtonControl)
{
;
info (“Dynamic button clicked!”);
}

void JKCombobox_Modified(FormComboBoxControl _formComboBoxControl)
{
Bill_TabMethod btm;
FormComboBoxControl cb=element.controlCallingMethod();
info(cb.valueStr());
// select btm where btm.CustName==cb.valueStr();
//info(btm.ItemName);
}

OUTPUT:

RuntimeControl

Advertisements

2 comments on “Create Runtime form control and get the value in Ax 2012

  1. Pingback: Create Runtime form control and get the value in Ax 2012 - Microsoft Dynamics AX Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s