<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Adding checkbox into repeating table programmatically (C#)</title><link>https://www.infopathdev.com:443/forums/thread/104767.aspx</link><pubDate>Thu, 19 Nov 2015 19:49:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104767</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104767.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104767</wfw:commentRss><description>Oh wow - didn&amp;#39;t expect it to be that easy. :) Glad it is working for you!</description></item><item><title>Re: Adding checkbox into repeating table programmatically (C#)</title><link>https://www.infopathdev.com:443/forums/thread/104766.aspx</link><pubDate>Thu, 19 Nov 2015 19:24:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104766</guid><dc:creator>arkainus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104766.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104766</wfw:commentRss><description>Nice, that was it. There was nothing in the checked/unchecked values on the control, and that was what was causing the issue. I&amp;#39;m not sure how it came to be that there was no value in there, but as soon as I filled those dropboxes in, the code now works. Thank you Hilary!</description></item><item><title>Re: Adding checkbox into repeating table programmatically (C#)</title><link>https://www.infopathdev.com:443/forums/thread/104765.aspx</link><pubDate>Thu, 19 Nov 2015 18:55:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104765</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104765.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104765</wfw:commentRss><description>In your form, what is the data type for the field bound to the checkbox? If you right click the checkbox, what are the checked and unchecked values?</description></item><item><title>Re: Adding checkbox into repeating table programmatically (C#)</title><link>https://www.infopathdev.com:443/forums/thread/104764.aspx</link><pubDate>Thu, 19 Nov 2015 18:46:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104764</guid><dc:creator>arkainus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104764.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104764</wfw:commentRss><description>Sorry - tried updating the post - the code stripped out some locations, and the innerxml I show also got stripped, and my edits weren&amp;#39;t fixing it and I didn&amp;#39;t want to keep editing the post unsuccessfully. I put the code in the attached txt file, as well as the innerxml example.  Thank you again for any help you may have to offer.</description></item><item><title>Adding checkbox into repeating table programmatically (C#)</title><link>https://www.infopathdev.com:443/forums/thread/104763.aspx</link><pubDate>Thu, 19 Nov 2015 18:18:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104763</guid><dc:creator>arkainus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104763.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104763</wfw:commentRss><description>Hey Everyone,&lt;p&gt;
&lt;p&gt;
I have a form with a button that I want use to programmatically retrieve sql data, fill it into a sqldatareader object, which I use to populate a stringbuilder string, to finally append as a child to a repeating table element in infopath. The repeating table has five fields in the schema, four of which are text, and one of which is a boolean value. My code seems to work, but unfortunately, when I go to place a check in one of the checkboxes that populates due to this code, the box receives a red highlight telling me &amp;quot;Only &amp;#39;true&amp;#39; or &amp;#39;false&amp;#39; allowed&amp;quot;. &lt;p&gt;
&lt;p&gt;
My code looks like the following: &lt;p&gt;
&lt;pre&gt;	    //reset all rows on the repeating table
            XPathNavigator mainDS = MainDataSource.CreateNavigator();
            StringBuilder sb = new StringBuilder();
            XPathNavigator firstRow = mainDS.SelectSingleNode(&amp;quot;/my:myFields/my:updatePartyInfo/my:partyTable/my:group8/my:group9&amp;quot;, NamespaceManager);
            XPathNavigator lastRow = mainDS.SelectSingleNode(&amp;quot;/my:myFields/my:updatePartyInfo/my:partyTable/my:group8/my:group9[position() = last()]&amp;quot;, NamespaceManager);
            if (firstRow != null &amp;amp;&amp;amp; lastRow != null)
                firstRow.DeleteRange(lastRow); //Make try/catch to ignore exception if called on a table that has already been cleared (i.e. first run retrieved no records)

            using (SqlCommand command = connection.CreateCommand())
            {
                //command.CommandText = queryString;
                command.CommandText = sqlQuery;

                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    int count = 1;
                    string my = NamespaceManager.LookupNamespace(&amp;quot;my&amp;quot;);
                    string xpath = &amp;quot;/my:myFields/my:updatePartyInfo/my:partyTable/my:group8/my:group9&amp;quot;;
                    XPathNavigator group = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
                    while (reader.Read())
                    {
                        string partyCode = reader[&amp;quot;party_code&amp;quot;].ToString();
                        string rowId = count.ToString();
                        string contID = reader[&amp;quot;event_code&amp;quot;].ToString();
                        string address = reader[&amp;quot;full_addr&amp;quot;].ToString();
                        sb.Append(&amp;quot;&amp;quot;);
                        sb.Append(&amp;quot;&amp;quot; + count.ToString() + &amp;quot;&amp;quot;);
                        sb.Append(&amp;quot;&amp;quot; + contID + &amp;quot;&amp;quot;);
                        sb.Append(&amp;quot;&amp;quot; + partyCode + &amp;quot;&amp;quot;);
                        sb.Append(&amp;quot;&amp;quot; + address + &amp;quot;&amp;quot;);
                        sb.Append(&amp;quot;true&amp;quot;);
                        sb.Append(&amp;quot;&amp;quot;);
                        count++;
                    }
                }
                connection.Close();

                sb = sb.Replace(&amp;quot;&amp;amp;&amp;quot;, &amp;quot;ampersand;&amp;quot;); //fields with ampersands throw schema validation
                MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:updatePartyInfo/my:partyTable/my:group8&amp;quot;, NamespaceManager).AppendChild(sb.ToString());&lt;/pre&gt;&lt;p&gt;
&lt;p&gt;
I&amp;#39;ll also attach as a text file, as I always have trouble getting the formatting to look good on this forum. The selectThisParty field is the checkbox field. In the example above, I&amp;#39;m giving it a value of true. I&amp;#39;ve tried &amp;quot;TRUE&amp;quot;, &amp;quot;false&amp;quot;, &amp;quot;FALSE&amp;quot; and leaving the value blank, which all produce errors - the uppercase and blank examples making the field surrounded by the red invalid markers right upon population, whereas the lowercase looks good, until you try and actually populate a check into one of the boxes - then that individual box is surrounded with the red markers. 
&lt;p&gt;So my question is - is there something special I have to be doing here when inserting a checkbox versus a text field? I use the sb object compile all of the elements because I noted that large datasets were significantly faster this way - one appendchild() call, rather than multiple appendchildelements(). Does anyone have any ideas what I&amp;#39;m screwing up here? The frustrating thing is if I compare the InnerXML of the table when created by default, the selectThisParty is represented like so: &lt;pre&gt;&amp;quot;false&amp;quot;&lt;/pre&gt;. My code produces the same thing, so it seems like it &lt;em&gt;should&lt;/em&gt; work.  I&amp;#39;d love to see if anyone has any pointers on what I&amp;#39;m doing wrong, or how I might fix. Thank you in advance for your time.</description></item></channel></rss>