How to Populate Dropdown list in a Repeating table programmatically? - InfoPath Dev
in

InfoPath Dev

How to Populate Dropdown list in a Repeating table programmatically?

Last post 01-23-2009 08:11 AM by dipesh. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 12-25-2008 08:05 PM

    • sujaza
    • Not Ranked
    • Joined on 12-26-2008
    • Posts 7

    How to Populate Dropdown list in a Repeating table programmatically?

    Hi

    I have a repeating table with several Textbox controls and one dropdown list box control. I need to populate the repeating table from a sharepoint list in such a way that the dropdown list has a predefined set of values from another list with one value set as default.

    For eg: I have a list with items Yes,No,N/A and when the form is rendered in browser, the repeating table should have a set of rows with the dropdown set to say, No as default. The default value to be set for each dropdown may vary based on the list item.

    The repeating table  controls should be editable including the dropdown control.

    Can anyone help me in achieving this ??

    Thanks in advance

    SujaZa

     

  • 12-25-2008 08:58 PM In reply to

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    Hi,

    Use an xml file and put the predefined set of values in that xml. Use this xml file as the external data source to get the data in the drop down. When you open the form and after getting the sharepoint list add those values in to the xml file. So that the predefined values and the sharepoint list items both will be shown in the drop down. You can set the default value using the following codeline.

    thisXDocument.DOM.selectSingleNode("xpath of your field").text = "default value";

    Swathip
    www.ggktech.com
  • 12-25-2008 09:15 PM In reply to

    • sujaza
    • Not Ranked
    • Joined on 12-26-2008
    • Posts 7

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    Thank you Swathi for your reply.

    will you be able to explain how to set the Xml document values and bind to dropdown?

    My list item rows for the repeating table are like this,

    FirstName  LastName  Constraint

    Suja           ZV                 Yes

    Swathi        P                    N/A

     

    Here FirstName and LastName are text boxes and Constraint is a dropdown list with predefined set of values Yes,No,N/A. These rows should appear in the repeating table with Constaint column set accordingly in an editable mode.

     

    From this I understand that I have to set the list item values in an Xml document and use  that to populate the dropdown.So fat I have seen that, if i use SetValue mathod it will add a duplicate right in side my dropdown ie, the data from the secondary data connection plus the one I set[becomes a duplicate)??

     

     

     

  • 12-25-2008 09:23 PM In reply to

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    Will the dropdown control always have just the three possible values Yes, No, and N/A?  If so, just bind it to a node in the same repeating section as FirstName and LastName and enter the values, Yes, No, and N/A in the dropdown's properties.  No need to populate its items from a secondary data source.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-25-2008 09:30 PM In reply to

    • sujaza
    • Not Ranked
    • Joined on 12-26-2008
    • Posts 7

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    Jimmy Thanks for your response!!

     The dropdown control can have additional options as well which can be entered by the user in a sharepoint list.

     

    Thnx

    Suja

  • 12-27-2008 12:32 AM In reply to

    • sujaza
    • Not Ranked
    • Joined on 12-26-2008
    • Posts 7

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    I was able to achive this after some googling.:)

    I used the StringBuilder to set the xml nodes for repeating table and added the rows using

    AppendChild(). The drop down will look up values from the secondary data connection still. Once you use add the AppendChild the dropdown s default value will be set from the secondary connection itself. User can edit the values later on.

  • 01-23-2009 08:11 AM In reply to

    Re: How to Populate Dropdown list in a Repeating table programmatically?

    i have a repeting section with drop down containg XML datasource.
    user can select list of data from drop down and accordingly to text boxes
    are filled with that drop down values.

    but as this is in repeting section.
    it is failed after no of rows are added.

    it behaves differently for filling data in last row first i have to click
    on first row's drop down then it will i think postback the form, then i click
    on last row's drop down then it will fill values in last row's textboxes.

    so on second click on drop down it will fill data from drop down after first
    row in repeting it behave like this.

    please advise..

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