Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

View.SelectNodes Method (XPathNavigator, XPathNavigator, String)

Office 2010

Selects a range of nodes in a view based on the specified starting XML node, the ending XML node, and the specified control.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
public abstract void SelectNodes(
	XPathNavigator startNode,
	XPathNavigator endNode,
	string viewContext
)

Parameters

startNode
Type: System.Xml.XPath.XPathNavigator
An object that specifies the start node for the selection.
endNode
Type: System.Xml.XPath.XPathNavigator
An object that specifies the end node for the selection.
viewContext
Type: System.String
The ViewContext identifier for the control or group in which to select text.
ExceptionCondition
InvalidOperationException

The SelectNodes method was called from an event handler for the Loading event.

ArgumentNullException

The parameters passed to this method are a null reference (Nothing in Visual Basic).

ArgumentException

The parameters passed to this method are not valid. For example, they are of the wrong type or format.

When using the SelectNodes method, if the specified range of nodes is bound to more than one control in the view, you must also provide the ViewContext identifier to specify which control contains the nodes to select. You can determine the ViewContext identifier for a control by opening the form template in Design mode, displaying the control's Properties dialog box, and then clicking the Advanced tab.

When the ViewContext identifier is specified, all of the XML nodes that have been specified to be selected must be within that context.

NoteNote

The SelectNodes method requires that the specified nodes be structurally selectable in the view.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

In the following example, group2 is bound to more than one Repeating Table control, one of which has the ViewContext identifier of "CTRL2". The SelectNodes(startNode,endNode,viewContext) method is used to select the range of nodes starting from the first row to the third row that are bound to the control with the ViewContext identifier of "CTRL2".

// Create XPathNavigators to specify range of nodes.
XPathNavigator repeatingTableRow1 = 
   CreateNavigator().SelectSingleNode(
   "/my:myFields/my:group1/my:group2[1]", NamespaceManager);
XPathNavigator repeatingTableRow3 = 
   CreateNavigator().SelectSingleNode(
   "/my:myFields/my:group1/my:group2[3]", NamespaceManager);

// Select range of nodes in specified XPathNavigators.
CurrentView.SelectNodes(
   repeatingTableRow1, 
   repeatingTableRow3,
   "CTRL2");
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.