Condividi tramite


XmlFormView.NotifyHost Event

Handles the host notification event of a form in an XmlFormView control.

Namespace:  Microsoft.Office.InfoPath.Server.Controls
Assembly:  Microsoft.Office.InfoPath.Server (in Microsoft.Office.InfoPath.Server.dll)

Syntax

'Declaration
Public Event NotifyHost As EventHandler(Of NotifyHostEventArgs)
'Usage
Dim instance As XmlFormView
Dim handler As EventHandler(Of NotifyHostEventArgs)

AddHandler instance.NotifyHost, handler
public event EventHandler<NotifyHostEventArgs> NotifyHost

Remarks

This event represents one of four events of the XmlFormView control that allows communication of a form in the control to the Web page in which the control is hosted. Read-only properties of the form can be queried when code in the form is used to notify the hosting Web page. These properties are available through the XmlForm property of the XmlFormView control.

Examples

In the following example, the XmlFormView control, XmlFormView1, is hosted in a custom Web page and contains a browser-enabled form template located on the same site. The NotifyHost event of the XmlFormView control is used to populate a control, TextBox1, in the custom Web page.

Imports Microsoft.Office.InfoPath.Server.Controls
Protected Sub XmlFormView1_NotifyHost(ByVal sender As Object, ByVal e As Microsoft.Office.InfoPath.Server.Controls.NotifyHostEventArgs) Handles XmlFormView1.NotifyHost
    TextBox1.Text = e.Notification.ToString()
End Sub

The form code necessary to send a value from the main data source in the form, my:field2, to the hosting Web page uses the NotifyHost method of the XmlForm object available in the Microsoft.Office.InfoPath namespace, in this case from a button in the form.

Public Sub CTRL3_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
    Dim myNav As XPathNavigator = Me.MainDataSource.CreateNavigator()
    Me.NotifyHost(myNav.SelectSingleNode("/my:myFields/my:field2", Me.NamespaceManager).ToString())
End Sub
using Microsoft.Office.InfoPath.Server.Controls
protected void XmlFormView1_NotifyHost(object sender, NotifyHostEventArgs e)
{
    TextBox1.Text = e.Notification.ToString();
}

The form code necessary to send a value from the main data source in the form, my:field2, to the hosting Web page uses the NotifyHost method of the XmlForm object available in the Microsoft.Office.InfoPath namespace, in this case from a button in the form.

public void CTRL3_5_Clicked(object sender, ClickedEventArgs e)
{
    XPathNavigator myNav = this.MainDataSource.CreateNavigator();
    this.NotifyHost(myNav.SelectSingleNode("/my:myFields/my:field2", this.NamespaceManager).ToString());
}

See Also

Reference

XmlFormView Class

XmlFormView Members

Microsoft.Office.InfoPath.Server.Controls Namespace