I have a group of radio stations that I am trying to populate using the library iTextSharp. When I opened the PDF in iText RUPS, I see the following:

Here's how to do it in a PDF file:

I have the following code that should fill in either the MALE or FEMALE switch:
if (reader.GetValue(4).ToString() == "M")
{
pdfFormFields.SetField("SEXpg2", "Yes");
}
else
{
pdfFormFields.SetField("SEXpg2", "Yes");
}
When I run the PDF form, no radio is populated. How can I change the code in the screenshot so that it fills any radio station based on the gender column from the SQL query?
I tried the following, but that did not work:
if (reader.GetValue(4).ToString() == "M")
{
pdfFormFields.SetField("MALEpg2", "Yes");
}
else
{
pdfFormFields.SetField("FEMALEpg2", "Yes");
}
source
share