
I have a Multiple Selection Box in infopath with four manual values. Now how can I check two of the options from code behind C# (Say "Option One and Option Three").
At the moment if I am adding these two from code behind by saying,
XPathNavigator elemYourTextBox = this.MainDataSource.CreateNavigator().SelectSingleNode("//my:MSList", this.NamespaceManager);
elemYourTextBox.SetValue("Option One");
elemYourTextBox.SetValue("Option Two");
only Option Two gets selected.
It has been a while since I have used InfoPath So I may be off the mark here. The reason, I believe, is you are setting one value twice. once as
Option Onethen asOption Two. You will need to replicate how infopath inserts the values into the text field to get the default values selected. One thing to consider is that you may need a collection of values for this to work that way you want, as that is usually how Infopath works with multiple values.Found this article that will help Pre-select items in a Multiple-Selection List Box in InfoPath 2010