I have InfoPath form that has two dropdown lists with a datasource coming from same sharepoint list. One is getting code field and the other description field. I want when a user selects one of the ddls then the other is updated with selected value's description or code.
e.g. when user select "code1" in code ddl then the other dropdown is populated with the "descriptopn1" of the selected code or if the user selects a "description2" in description dll then the code ddl is updated with "code2".
I have the following code that works fine for the first row but when a new row is inserted and when a user selects a code or description then it doesn't update the current rows ddl but the first row. I need your help on this:
publicvoid codeDDL_Changed(object sender,XmlEventArgs e){if(e.Operation==XmlOperation.ValueChange){XPathNavigator selectedCode = e.Site;XPathNavigator navigation =DataSource["Data Source for DDL"].CreateNavigator().SelectSingleNode("dfs:myFields/dfs:dataFields/d:SharePointListItem_RW",NameSpaceManager);do{Navigation.MoveToFirstChild();if(navigation.Value== selectedCode.Value){
navigation.MoveToNext();MainDataSource.CreateNavigator().SelectSingleNode("description ddl's xpath",NameSpaceManager).SetValue(navigation.Value);return;}
navigation.MoveToParent();}while(navigation.MoveToNext());}}