Filling up a repeating Field with Code (C#) - InfoPath Dev
in

InfoPath Dev

Filling up a repeating Field with Code (C#)

Last post 01-11-2012 10:17 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-11-2012 09:59 AM

    Filling up a repeating Field with Code (C#)

    Hello everyone, I have a problem with filling up a Drop Down List Box. My Goal is this: I want to use code to fill up a Drop Down List Box because I want to use a Data Connection I've just created and there has to be some logic. To use code for this task I planned to Bind the Drop Down List Box to a repeating field. I have created a Group (called "AllMembers") and in that group is a repeating field called "SingleMember" which is Binded/Bound (?) to the Drop Down List (sorry for my English). I now tried to fill up the Field this way: Uploaded with ImageShack.us Unfortunately I get a nullreference Exception. Do you have any Idea what is wrong here? Maybe complete stupid way to do what I need? :-) Thanks!! I used this manual: http://www.bizsupportonline.net/infopath2007/programmatically-fill-populate-drop-down-list-box-infopath-2007.htm I am using InfoPath 2010. Regards Christian
  • 01-11-2012 10:17 AM In reply to

    Re: Filling up a repeating Field with Code (C#)

    My guess would be that the null reference exception is occurring when you set the value of "value" and "display", because SelectSingleNode is failing to select a node. I see that SingleMember is using the "my" namespace - are "value" and "display" children of SingleMember? If they are fields, they'd probably also be using the "my" namespace:

    newMember.SelectSingleNode("my:value", NamespaceManager).SetValue("test");

    For example (don't forget, you'll need a NamespaceManager for SelectSingleNode, since the XPath has a namespace).

    Hilary Stoupa

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.