简体   繁体   中英

Dynamically populate an InfoPath DropownList with managed code

I have an InfoPath form with custom C# code, and a Sharepoint list. I have a dropdownlist in the InfoPath form that I want to populate with a certain field from the Sharepoint list (I want the InfoPath dropdownlist to contain this field's value from every item in the Sharepoint list. I can successfully get the list of values I need from Sharepoint in my managed code, but I do not see how I can get these values into the dropdownlist (either bind to the list, or add each item in the list one by one). I thought I could modify the XML of the dropdownlist to insert my items, but the XML only contains the first item in the dropdownlist:

 <my:RelatedRiskID xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-07-20T18:12:59">Option 1</my:RelatedRiskID> 

I feel like this should be possible, but I can't find any resources on how to do it. Thanks in advance for the help.

If you plan to populate your dropdown list with a SharePoint list then you need to

  • create a data connection to the said SharePoint list
  • in the dropdown list Data tab, get the data externally and select the said data connection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM