-
Okay, so I see:
newNode.SelectSingleNode("@Applications", this.NamespaceManager).SetValue(auxDomNode.Value);
parent.AppendChild(newNode);
But to have your rule fire, I'd want to see:
parent.AppendChild(newNode);
newNode.SelectSingleNode("@Applications", this.NamespaceManager).SetValue(auxDomNode.Value);
So ...
-
Just to verify -- the rule is set on the field you wish to populate via this code? Can you paste your code again so we have the latest?
-
The rule isn't firing because we are filling the values, then appending the node. You can switch the lines in the for each loop so that the line:
parent.AppendChild(newNode);
Comes before the line that starts with:
newNode.SelectSingleNode
This way the newNode has been attached to the main dom BEFORE the value is set.....and your rule ...
-
Jimmy was right -- it is the xpath you are using. The variable auxDomNode is already at ns1:Application. So instead of:
XPathNodeIterator auxDomNodes = ...
-
You aren't off base... but that is what we are doing with this line: foreach (XPathNavigator auxDomNode in auxDomNodes). We have a node list that we are calling auxDomNodes. In the for each statement, we are saying "for each of the nodes in that node list, do the following". So when we refer to auxDomNode in the for each statement, ...
-
I don't think "my:Applications" is a child of the newNode node, is it? Your xpath for the parent variable is "dfs:myFields/dfs:dataFields/d:Employee" which makes me believe this is a databound form. I'd expect '@Applications' for newNode.SelectSingleNode("my:Applications", this.NamespaceManager).
-
You bet -- you mean the labels? Tools / Options / Design and under General, you'll see a checkbox you can deselect....
-
I didn't specify that you'd need to change the xpath on that line, but you do... sorry for that! See where it says 'auxDomNode.SelectSingleNode("@Text") -- you'll want to change that to point to the actual field in your app list data source that holds the value you want to use in newNode....My test database has silly ...
-
I can't help but wonder if there isn't an easier way. Is your form bound to a data base? Or created from scratch? If you started with a blank form, you might want to consider adding attributes to the fields w/ the checkboxes. The attribute could store a value and each checkbox field would have a single rule to modify the attribute value... ...
-
So you are querying in code and then need to access the results of that query in code? Can you share your code thus far?