DataDOMEvent.Site Property

Definition

Gets a reference to the XML Document Object Model (DOM) node where the data validation event is currently being processed.

public:
 property Microsoft::Office::Interop::InfoPath::SemiTrust::IXMLDOMNode ^ Site { Microsoft::Office::Interop::InfoPath::SemiTrust::IXMLDOMNode ^ get(); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode Site { get; }
member this.Site : Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode
Public ReadOnly Property Site As IXMLDOMNode

Property Value

Examples

In the following example, the DataDOMEventObject object is used to check the value of the node using the Site property. If the data validation fails, the ReportError(Object, String, Boolean, String, Int32, String) method is used to create a custom error.

[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.OnValidate)]
public void field1_OnValidate(DataDOMEvent e)
{
if(e.Site.text != "")
 {
  int quantity = int.Parse(e.Site.text.ToString());
  if(quantity > 50)
  {
   e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot exceed 50.", false, "", 2,"modeless");
  }

  if(quantity < 0)
  {
   e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot be less than 0.", false,"", 2,"modeless");    
  }
 }
}

Remarks

After you have set a reference to the XML DOM node that the Site property returns, you can use any of the properties and methods that are supported by the XML DOM.

Important: 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.

Applies to