技术开发 频道

InfoPath 获取重复表的Value


【IT168技术文档】

  在以下示例中,将使用 SelectNodes(XPathNavigator,XPathNavigator,String) 方法选择绑定到 group2 的“重复表”控件的第一行中的节点。然后使用 GetContextNodes 方法基于当前所选项和指定节点返回上下文节点的集合。最后,代码将遍历上下文节点的集合,并显示每个节点的名称、内部 XML 和值。
// Create XPathNavigator and specify XPath for nodes. XPathNavigator repeatingTableRow1 = MainDataSource.CreateNavigator().SelectSingleNode( "/my:myFields/my:group1/my:group2[1]", NamespaceManager); // Select nodes in specified XPathNavigator. CurrentView.SelectNodes(repeatingTableRow1,repeatingTableRow1,"CTRL5"); // Get context nodes in selection. XPathNodeIterator contextNodes = CurrentView.GetContextNodes(repeatingTableRow1,"CTRL5"); // Loop through collection and display information. foreach (XPathNavigator contextNode in contextNodes) { MessageBox.Show(contextNode.Name); MessageBox.Show(contextNode.InnerXml); MessageBox.Show(contextNode.Value); }
0
相关文章