<?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: "Attempt to modify a read-only node" error when setting field</title><link>https://www.infopathdev.com:443/forums/thread/42339.aspx</link><pubDate>Mon, 01 Jun 2009 02:59:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42339</guid><dc:creator>sreid1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42339.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42339</wfw:commentRss><description>&lt;p&gt;Hey Patrick,&lt;/p&gt;
&lt;p&gt;As a followup to my other message this morning. You were right! Adding in the rules instead of using the code-behind has fixed all the problems. Plus it allowed me to set a bunch of fields with only one call, so I&amp;#39;m extra happy today.&lt;/p&gt;
&lt;p&gt;Thanks again for your help!&lt;/p&gt;
&lt;p&gt;Cheers -- Stuart&lt;/p&gt;</description></item><item><title>Re: "Attempt to modify a read-only node" error when setting field</title><link>https://www.infopathdev.com:443/forums/thread/42337.aspx</link><pubDate>Sun, 31 May 2009 23:19:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42337</guid><dc:creator>sreid1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42337.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42337</wfw:commentRss><description>&lt;p&gt;Hi Patrick, 
&lt;p&gt;I&amp;#39;m using code as I&amp;#39;m pretty new to the whole Infopath thing. I came across an article online somewhere which had this way of doing things, so I was apeing that. &lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t realise I can do it all with rules and actions, so I&amp;#39;ll look into that way instead. I&amp;#39;d prefer to steer away from the code-behind as much as possible, so that&amp;#39;s great!&amp;nbsp;Thanks for the suggestion.&lt;/p&gt;
&lt;p&gt;If I have any other problems/questions I&amp;#39;ll post them.&lt;/p&gt;
&lt;p&gt;Thanks again&amp;nbsp;-- Stuart&lt;/p&gt;</description></item><item><title>Re: "Attempt to modify a read-only node" error when setting field</title><link>https://www.infopathdev.com:443/forums/thread/42328.aspx</link><pubDate>Sun, 31 May 2009 18:34:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42328</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42328.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42328</wfw:commentRss><description>&lt;p&gt;Hi Stuart,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure exactly why you are using code. You should be able to do this without code using rules and actions to query the Web service and set values based on it. If you have written code in an OnAfterChange event handler it&amp;#39;s possible that InfoPath locks the field that caused the event to fire since that would produce another call to the event handler. :)&amp;nbsp; &lt;/p&gt;</description></item><item><title>"Attempt to modify a read-only node" error when setting field</title><link>https://www.infopathdev.com:443/forums/thread/42238.aspx</link><pubDate>Fri, 29 May 2009 06:08:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42238</guid><dc:creator>sreid1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42238.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42238</wfw:commentRss><description>&lt;p&gt;Hey Everyone,&lt;/p&gt;&lt;p&gt;I&amp;#39;m having a problem which is driving me crazy, so hopefully someone can help me.&lt;/p&gt;&lt;p&gt;I have a drop-down list on a form, which I have added a rule to so that when the value changes, some code-behind c# code is called. This c# code calls a webservice to retrieve some data based on the user selection. All that works fine, and the data is retrieved successfully.&lt;/p&gt;&lt;p&gt;When I try and update the appropriate field, however, I get an exception saying &amp;quot;Attempt to modify a read-only node&amp;quot;. I have checked the field, and I can update it manually no problem. If I check the node itself before setting the value the &amp;quot;CanEdit&amp;quot; bool is set to &amp;quot;True&amp;quot;. The last puzzling thing is that this code works fine for setting fields during the on load event. &lt;/p&gt;&lt;p&gt;This is the code I&amp;#39;m using to try and set the value of the field: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;PathNavigator xnMyForm = MainDataSource.CreateNavigator();&lt;br /&gt;xnMyForm.SelectSingleNode(&amp;quot;//my:&amp;quot; + fieldName, NamespaceManager).SetValue(param); &lt;/p&gt;&lt;p&gt;The rule I&amp;#39;m using only has a condition which is &amp;quot;The expression&amp;quot; and xdExtension:UpdateFields()&amp;quot;. I don&amp;#39;t think this is the problem though, as the method is being called correctly.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If anyone can help me out with a solution, or how to investigate this problem further, I&amp;#39;d be most grateful.&lt;/p&gt;&lt;p&gt; Cheers -- Stuart &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>