C
Codewzrd
I posted this on the http://www.infopathdev.com forums but that site doesn't
get a lot of traffic. Yet.
The following works when I am debugging and I update the XML manually as I
step through the code. I do get back a list of orders.
A user selects the the customer id from the drop down list box. I take the
ID and want to pass it to a web service method programmatically. I tried to
store the ID in the data source's XML as a text value but I keep getting an
error:"Reference to undeclared namespace prefix: 'dfs'".
Here is the code that I have so far:
[InfoPathEventHandler(MatchPath="/my:myFields/my:field1",
EventType=InfoPathEventType.OnAfterChange)]
public void field1_OnAfterChange(DataDOMEvent e)
{
// Write code here to restore the global state.
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
// A field change has occurred and the DOM is writable. Write code here to
respond
// to the changes.
DataObject objDO = null;
objDO = thisXDocument.DataObjects["GetPIDs"];
IXMLDOMNode QueryInput =
objDO.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/s0:GetPIDs/s0:nRID"
);
IXMLDOMNode RidNode =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1");
QueryInput.text = RidNode.text;
objDO.Query();
}
It's failing on the QueryInput = objDO.DOM.selectSingleNode line. I've read
that you may have to set the Namespace before I can select a node, by using
the setProperty property of the DOM. But there is no such property.
Any code example or ideas would be greatly appreciated.
get a lot of traffic. Yet.
The following works when I am debugging and I update the XML manually as I
step through the code. I do get back a list of orders.
A user selects the the customer id from the drop down list box. I take the
ID and want to pass it to a web service method programmatically. I tried to
store the ID in the data source's XML as a text value but I keep getting an
error:"Reference to undeclared namespace prefix: 'dfs'".
Here is the code that I have so far:
[InfoPathEventHandler(MatchPath="/my:myFields/my:field1",
EventType=InfoPathEventType.OnAfterChange)]
public void field1_OnAfterChange(DataDOMEvent e)
{
// Write code here to restore the global state.
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
// A field change has occurred and the DOM is writable. Write code here to
respond
// to the changes.
DataObject objDO = null;
objDO = thisXDocument.DataObjects["GetPIDs"];
IXMLDOMNode QueryInput =
objDO.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/s0:GetPIDs/s0:nRID"
);
IXMLDOMNode RidNode =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1");
QueryInput.text = RidNode.text;
objDO.Query();
}
It's failing on the QueryInput = objDO.DOM.selectSingleNode line. I've read
that you may have to set the Namespace before I can select a node, by using
the setProperty property of the DOM. But there is no such property.
Any code example or ideas would be greatly appreciated.