Skip to Content
0
Former Member
Dec 09, 2008 at 10:47 AM

Code to creating Radio Button

13 Views

Hi All,

We are trying to create Radio Button UI Element dynamically.

IWDTransparentContainer container = (IWDTransparentContainer) view.getElement( "RootUIElementContainer");

IWDRadioButton radiobutton = (IWDRadioButton)view.createElement(IWDRadioButton.class, "MyRadioButton");

container.addChild(radiobutton);

This is the code we are using. We have craeted 2 context attributes and set the KeyToSelect and SelectedKey properties to it.

radiobutton.setKeyToSelect("radiooptions.male");

radiobutton.setSelectedKey("radiooptions.common");

Now for setting teh default radio button we gave this,

wdContext.currentRadiooptionsElement().setMale(1);

wdContext.currentRadiooptionsElement().setCommon(1);

But its giving an error:

com.sap.tc.webdynpro.progmodel.context.ContextException: Path null does not point to an attribute, but to com.sap.tc.webdynpro.progmodel.generation.DelegatingView@e6846b

And if we dont give the context and just create a radio button, the radio button comes as greyed out, even the text that we set is coming greyed out.

Please help me out with this...

Regards,

Becky.