NotifyHostEventArgs class
Used to send data from the hosted InfoPath form template to the Web page.
Assembly: Microsoft.Office.InfoPath.Server (in Microsoft.Office.InfoPath.Server.dll)
If XML data is passed to the XmlFormView control using the NotifyHost method of the XmlForm object available in the Microsoft.Office.InfoPath namespace, it is not validated before it is sent. Use the SubmitToHost event and a corresponding SubmitToHostAdapter data connection from the form to receive validated XML in the Web page.
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.
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()); }