_XDocument3.NotifyHost(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a custom value to the hosting application or ASPX page.
public:
void NotifyHost(System::String ^ bstrNotification);
public void NotifyHost (string bstrNotification);
abstract member NotifyHost : string -> unit
Public Sub NotifyHost (bstrNotification As String)
Parameters
- bstrNotification
- String
A custom value that will be used by the code in the hosting application or ASPX page.
Examples
The following example shows what the event handler in the code-behind of an ASPX page would need look like in order to receive the string value provided by the NotifyHost method. In this example, the NotifyHost method would be providing "ActionA" as the bstrNotification
parameter, and the event handler would perform a conditional action when the value is received.
private void XmlFormView1_NotifyHost(Object sender,
NotifyHostEventArgs e)
{
if (e.Notification == "ActionA")
{
// Code to perform if 'ActionA' is received.
}
else
{
// Code to perform an alternative action.
}
}
Private Sub XmlFormView1_NotifyHost(sender As Object, _
e As NotifyHostEventArgs)
If (e.Notification = "ActionA") Then
' Code to perform if 'ActionA' is received.
Else
' Code to perform an alternative action.
End If
End Sub
The following example shows what the event handler in the code-behind of an ASPX page would need look like in order to receive the string value provided by the NotifyHost method. In this example, the NotifyHost method would be providing "ActionA" as the bstrNotification
parameter, and the event handler would perform a conditional action when the value is received.
private void XmlFormView1_NotifyHost(Object sender,
NotifyHostEventArgs e)
{
if (e.Notification == "ActionA")
{
// Code to perform if 'ActionA' is received.
}
else
{
// Code to perform an alternative action.
}
}
Private Sub XmlFormView1_NotifyHost(sender As Object, _
e As NotifyHostEventArgs)
If (e.Notification = "ActionA") Then
' Code to perform if 'ActionA' is received.
Else
' Code to perform an alternative action.
End If
End Sub
Remarks
The NotifyHost method is intended for use in scenarios where an InfoPath form template is hosted in an Microsoft.Office.InfoPath.Server.Controls.XmlFormView control on an ASPX page running from Microsoft SharePoint Server 2010 with InfoPath Forms Services. The value you provide for the notification
parameter is a string that can be used by the code-behind of the host ASPX page to perform a custom action.
For information about hosting an InfoPath form template in an ASPX page, see the article titled "Hosting the InfoPath Form Editing Environment in a Custom Web Form" on the InfoPath Developer Portal
The NotifyHost method can also be used when the InfoPath application is itself hosted as a control in another application, although in that scenario you would typically use the Host property to retrieve a custom object for working with the host application's object model instead.
For information about hosting InfoPath as a control in another application, see the article titled "Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form" on the InfoPath Developer Portal
Because the NotifyHost method is new to Microsoft InfoPath, you must declare and cast to the _XDocument3 type to access this method. For more information, see How to: Use Object Model Members That Are Not Compatible with InfoPath 2003.
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.