dropdownbox - InfoPath Dev
in

InfoPath Dev

dropdownbox

Last post 01-08-2009 09:20 AM by cali_kid. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 11-30-2008 03:41 PM

    dropdownbox

    I have a dropdownlist box in infopath form. Drop down gets filled from database's order table. sample values are

     order name               orderid 

    application kit           1

    rellocationform          2

     when i change value of dropdown box then how can i get text of dropdown box programatically through c#. for example if i select rellocationform in drop down then how can i get text value (rellocationform) in a variable using c#

     

    Thanks

     

  • 11-30-2008 04:10 PM In reply to

    There is no way to directly interact with InfoPath forms, so the only way to accomplish this is to get the current value of the field bound to the dropdown box, and then find the corresponding order name in the secondary data source that is being used to populate the form.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-30-2008 05:23 PM In reply to

    thanks i was able to do it but i had to introduce for each loop. is there any way i can avoid for loop and still achive the results. here is my code where i will like to avoid for loop

     

    XPathNavigator source = DataSources["GetOrders"].CreateNavigator();

    XPathNodeIterator retablerows = source.Select("/dfs:myFields/dfs:dataFields/tns:GetOrdersResponse/tns:GetOrdersResult/NewDataSet/Table[orderid='" + e.NewValue.Trim() + "']", NamespaceManager);

    foreach (XPathNavigator selectnode in retablerows)

    {

    string ordername = selectnode.SelectSingleNode("ordername", NamespaceManager).Value;

    }

  • 11-30-2008 05:35 PM In reply to

    Yes, this should work:

     XPathNavigator source = DataSources["GetOrders"].CreateNavigator();

    XPathNavigator ordernameNode = source.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetOrdersResponse/tns:GetOrdersResult/NewDataSet/Table/ordername[../orderid='" + e.NewValue.Trim() + "']", NamespaceManager);

    string ordername = ordernameNode.Value;

    The parts I've changed are in bold.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-01-2008 05:54 AM In reply to

    Jimmy,

     thanks very much. this is what i did in case someone else runs into same problem, here is the solution :-

    XPathNavigator GetOrderDS = DataSources["GetItem"].CreateNavigator();

    XPathNavigator ordernameNode = GetOrderDS.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetItemResponse/tns:GetItemResult/tns:clsItem/tns:ItemName[../tns:ItemID='" + LitNameI.Value + "']", NamespaceManager);

  • 12-16-2008 11:40 AM In reply to

    Will this solution work in a form that is render via MOSS Form Services?

  • 12-16-2008 12:03 PM In reply to

    yes i did on that browser enabled form if that's what you mean?

  • 12-16-2008 08:12 PM In reply to

    Can you provide the steps necessary to implement this in a browser enabled form? New to InfoPath, and need some guidance.

  • 12-17-2008 03:29 AM In reply to

    I have to understand that what you are trying to do.

     What I am doing here is I have repeating table that has several rows in it. and then I have a dropdown box outside the repeating table. I am trying to get the row from repeating table to match the value selected in dropdown box.

     thanks

  • 12-17-2008 12:48 PM In reply to

    I'm not using a repeating table, I have a secondary data connection that pulls in list items from a list in SharePoint. This connection populates a drop down control. There's about 2,000 records in the list, and when I render the form via the browser, the sort that is based off of the view does not work through InfoPath form services. I've read several bloggs about using a preserve code block, but that solution is not supported in a browser enabled form. This needs to be sorted alphabetically.

     

  • 01-08-2009 09:20 AM In reply to

    Found the answer.

     http://www.infopathdev.com/forums/t/10102.aspx

    This works without having to introduce code into the form. One of the requirements from this client is to create forms, and hand them off to someone who is not  a programmer.

     

    Thanks for the posts though.

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