Infopath web浏览中的多项选择功能

因为 Infopath web浏览没有提供多项选择功能,如果需要这个功能,解决方案是:

Repeating Table来实现

从某个数据连接中读出要显示的数据,然后用重复表的形式显示出来。

例程:

if (!this.New) return;
            XPathNavigator root = MainDataSource.CreateNavigator();

            DataSource myDataSource = this.DataSources["DS1"];
            XPathNavigator t1 = myDataSource.CreateNavigator();
            XPathNodeIterator t2s = t1.Select("dfs:myFields/dfs:dataFields/d:DS1",NamespaceManager);

            XPathNavigator options = root.SelectSingleNode("/my:myFields/my:options", NamespaceManager);
            XPathNavigator optionFirst = root.SelectSingleNode("/my:myFields/my:options/my:option", NamespaceManager);
            XPathNavigator myText;

            myText = optionFirst.SelectSingleNode("my:Text", NamespaceManager);
            string c2;

            while (t2s.MoveNext())
            {
                XPathNavigator myOption = optionFirst.Clone();
  
              myText = myOption.SelectSingleNode("my:Text", NamespaceManager);
                c2 = t2s.Current.GetAttribute("C2", "");
                myText.SetValue(c2)
                options.AppendChild(myOption);
            }
          
           optionFirst.DeleteSelf();

options是重复表,包含两个节点:selected和text,selected是布尔型,text是多选框对应的文字

你可能感兴趣的:(Path)