InfoPath: Populating Fields from Drop-Down Selection
page 2 of 4
by Michelle Beall
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 33131/ 67

Setting up the Example

Assume you want to call a Web service and pass in parameters supplied by the user at runtime.  The Web service will populate a drop-down list field in a repeating table.  The user should then be able to add rows at will to the repeating table and in each row make a selection from the drop-down list.  When the user selects an option, the corresponding repeating table row fields are populated with the correct data row values for the value selected. 

This example assumes the web service returns data in a structure similar to the following where all information related to a part number is in sibling nodes:

<font face="Verdana" color="black" size="2"><root>
    <materials>
        <partrecord>
            <partno></partno>
            <vendorpartno></vendorpartno>
            <description></description>
            …
        </partrecord>
        <partrecord>
            …
        </partrecord>
        …
    </materials>
</root></font>

Start by creating a new InfoPath project in Visual Studio.  In the InfoPath IDE add a text box, a repeating table with a drop-down list, and a text box with the following properties:

Text Box Name wsParam1
Data Type Text (string)
Drop-Down List Box Name field2
Data Type Text (string)
List box entries Lookup values in a data connection to the database, Web service, file, or SharePoint library or list
Text Box Name autofilledtext
Data Type Text (string)

Set up the drop-down list box to be populated dynamically at run time as described in Setting Secondary Data Source Web Service parameters using C# at runtime in InfoPath   We also need to add a hidden field to the main DOM with the following properties:

Name hdnSelectedVal
Data Type Text (string)

View Entire Article

User Comments

Title: great tip!   
Name: Schandmaul
Date: 2004-10-06 9:14:50 AM
Comment:
thank you a lot

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-09-20 9:17:35 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search