Multi-select list box select all - InfoPath Dev
in

InfoPath Dev

Multi-select list box select all

Last post 06-20-2011 11:17 AM by pluttod. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-17-2011 02:59 PM

    Multi-select list box select all

    I'm trying to create a button that will select all of the entries in a multi-select list box, so it can be used as a filter for a repeating table.  I created a group name "group1" with a repeating field named "field1".  the multi-select list box is getting it information from a sharepointlist "Site"

     

    public void CTRL4_7_Clicked(object sender, ClickedEventArgs e)

    {

    XPathNodeIterator Site = DataSources["Site"].CreateNavigator().Select(

    "//facility", NamespaceManager);

    foreach (XPathNavigator facility in Site)

    {

    string EHS_Lead_ID = facility.SelectSingleNode("EHS_Lead_ID", NamespaceManager).Value;

    AddItem(EHS_Lead_ID);

    }}

    private void AddItem(string itemId)

    {

    XPathNavigator DOM = MainDataSource.CreateNavigator();

    XPathNavigator group1 = DOM.SelectSingleNode("//my:group1", NamespaceManager);

    XPathNavigator field1 = DOM.SelectSingleNode("//my:group1/my:field1", NamespaceManager);

    XPathNavigator newNode = field1.Clone();

    newNode.SetValue(itemId);

    group1.AppendChild(newNode);

    }

  • 06-18-2011 01:48 PM In reply to

    Re: Multi-select list box select all

    Hi Pluttod,

    On quick inspection, I can't see any issue with your code. What are you seeing happen? Can you save the XML and see the fields in it?

    I created a sample form with a multi-select list box and filled it out and it adds a blank field1 at the top. You might want to just manually do this to see the XML that gets generated and then compare it to the XML you are creating.

    More later,

    Patrick Halstead
    Project Manager at Qdabra
  • 06-20-2011 05:00 AM In reply to

    Re: Multi-select list box select all

    Nothing is happening, I'm trying to get the button to select all the entries from the sharepoint list "Site", so they can be used as afilter for a repeating table.

  • 06-20-2011 05:07 AM In reply to

    Re: Multi-select list box select all

    XPathNavigator.Clone() doesn't work like you think it does.  You need to use AppendChild() first, re-select the newly added node, and then modify it.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-20-2011 05:38 AM In reply to

    Re: Multi-select list box select all

    I'm not sure how i would do that, what would the code look like

     

  • 06-20-2011 11:17 AM In reply to

    Re: Multi-select list box select all

    I tied by modifying the code with no luck

    XPathNavigator AppendChild=(field1);

    field1.SetValue(itemId);

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