How do I proerly set value on radio and check boxes when filling PDF forms?

Q: I developed a ASP.NET web service that fills in a PDF form template
with form data.

Everything is working great but I run into an issue with Check boxes
sometimes not appearing when checked using the following code:

using System;
using System.Collections;
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Text;
using pdftron.Filters;
using pdftron.PDF;
using pdftron.SDF;
using pdftron;

public partial class Home : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        string myFile = Server.MapPath("checkbox.pdf");
        byte[] larr_FileContents = File.ReadAllBytes(myFile);
        int lint_BuffSize = 0;
        PDFNet.Initialize();
        using (PDFDoc pdfDocument = new PDFDoc(larr_FileContents,
larr_FileContents.Length))
        {
            WriteFormDataToPdf("CheckBox2", "True", pdfDocument);
            WriteFormDataToPdf("CheckBox3", "True", pdfDocument);
            larr_FileContents = null;
            pdfDocument.Save("C:\\Temp\\apptest" +
Guid.NewGuid().ToString() + ".pdf",
SDFDoc.SaveOptions.e_remove_unused);
            pdfDocument.Save(ref larr_FileContents, ref lint_BuffSize,
SDFDoc.SaveOptions.e_remove_unused);
            Response.Write("sucess");
        }
    }
    catch
    {
        Response.Write("Failure");
    }
}

private bool WriteFormDataToPdf(string fieldName, string fieldValue,
PDFDoc pdfDocument)
{
    try
    {
        // Set field value in pdf
        FieldIterator fieldIterator =
pdfDocument.GetFieldIterator(fieldName);
        Field currentField = fieldIterator.Current();

        if (currentField != null)
        {
            currentField.SetValue(fieldValue);
            //
currentField.SetFlag(pdftron.PDF.Field.Flag.e_read_only, true);
            currentField.RefreshAppearance();
            return true;
        }
    }
    catch
    {
        throw new Exception("Unable set value '" + fieldValue + "' for
the field '" +
            fieldName + "'");
    }
    return false;
}
}
--------------------------

A: The problem is that you are setting the check box field value using
SetValue("True") instead of SetValue(true). The former version selects
the explicirtly provided appearance for the checkbox, but in your PDF
there is no such appearance (there is only "Yes" and "Off"
appearance). In most cases it is better to set the radio and check box
fields using field.SetValue(bool) instead of using an explicit
appearance.