谁能解决这个问题?谢谢了
//一级下拉框改变事件
public void field1_Changed(object sender, XmlEventArgs e)
{
XPathNavigator me = (XPathNavigator)sender;
if (me.Value == "")
return;
// 主数据源
XPathNavigator MainXpn = MainDataSource.CreateNavigator();
//辅助数据源
XPathNavigator RequestXpn = this.DataSources["getCodeTable"].CreateNavigator();
RequestXpn.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:getCodeTable/tns:codeTabelSetType", NamespaceManager).SetValue("codetable.xml");
//开始取参数
RequestXpn.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:getCodeTable/tns:codeTabelType", NamespaceManager).SetValue(me.Value);
//开始更新辅助数据源,问题出在这里:所有的二级下拉框菜单均访问这个数据源!
//所以二级下拉框菜单将同时更新!
this.DataSources["getCodeTable"].QueryConnection.Execute();
//尝试遍历?
XPathNodeIterator NodeIter = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:group1/my:group2", this.NamespaceManager);
string str1="";
foreach (XPathNavigator item in NodeIter)
{
XPathNavigator n1 = item.SelectSingleNode("my:field1", NamespaceManager);
str1 += n1.Value+",";
//遍历毫无意义!因为所有的二级下拉框菜单还是访问最后一次遍历得到的数据源
//只要下拉框使用数据源,下拉框的列表数据都将无法持久,选用其他方式的数据源还是会出现同样问题
RequestXpn.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:getCodeTable/tns:codeTabelType", NamespaceManager).SetValue(n1.Value);
this.DataSources["getCodeTable"].QueryConnection.Execute();
}