Welcome Guest Search | Active Topics | Sign In | Register

AcmRadioButton selected by default Options
Sanorbix
Posted: Tuesday, October 6, 2020 9:28:49 AM
Rank: Member
Groups: Member

Joined: 8/8/2019
Posts: 16
Hi - How do i render 3 acmradiobutton where one is selected by default. Acmcheckbox has a "checked" property acmradiobutton does not.

AcmRadioButton rboption1 = new AcmRadioButton();
rboption1.Name = "option";
rboption1.Value = "choice 1";
AcmRadioButton rboption2 = new AcmRadioButton();
rboption2.Name = "option";
rboption2.Value = "choice 2";
AcmRadioButton rboption3 = new AcmRadioButton();
rboption3.Value = "choice 3";

Thanks
eo_support
Posted: Wednesday, October 7, 2020 10:41:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

The code will be something like this:

Code: C#
PdfDocument doc = new PdfDocument();
AcmRender render = new AcmRender(doc);

//Create the radio buttons
AcmRadioButton rboption1 = new AcmRadioButton();
rboption1.Name = "option";
rboption1.Value = "choice 1";
AcmRadioButton rboption2 = new AcmRadioButton();
rboption2.Name = "option";
rboption2.Value = "choice 2";
AcmRadioButton rboption3 = new AcmRadioButton();
rboption3.Name = "option";
rboption3.Value = "choice 3";

//Render all the radio buttons
render.Render(rboption1, rboption2, rboption3);

//Set the second radio button as selected
rboption1.Group.SelectedIndex = 1;


Note that:

1. The radio button's Group property only exists after you call Render;
2. Each radio button must have a name and all radio buttons with the same name are grouped together;

Hope this helps. Please let us know if this works for you.

Thanks!



You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.