XmlFormView XmlFormView XmlFormView Class

Definition

The main ASP.NET control used to show InfoPath forms in a browser.

public ref class XmlFormView : System::Web::UI::WebControls::WebParts::WebPart
[Microsoft.SharePoint.WebControls.MdsCompliant(IsCompliant=false)]
public class XmlFormView : System.Web.UI.WebControls.WebParts.WebPart
Public Class XmlFormView
Inherits WebPart
Inheritance
XmlFormViewXmlFormViewXmlFormView
Attributes

Examples

<p>In the following example, the <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView"></xref> control, XmlFormView1, is hosted in a custom Web page and contains a browser-enabled form template located on the same site. The <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView.NotifyHost"></xref> event of the <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView"></xref> control is used to populate a control, TextBox1, in the custom Web page.</p>
<pre><code>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 Microsoft.Office.InfoPath.XmlForm.NotifyHost(System.String) method of the Microsoft.Office.InfoPath.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
<pre><code>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 Microsoft.Office.InfoPath.XmlForm.NotifyHost(System.String) method of the Microsoft.Office.InfoPath.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());
}
<p>In the following example, the <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView"></xref> control, XmlFormView1, is hosted in a custom Web page and contains a browser-enabled form template located on the same site. The <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView.NotifyHost"></xref> event of the <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.InfoPath.Server.Controls.XmlFormView"></xref> control is used to populate a control, TextBox1, in the custom Web page.</p>
<pre><code>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 XmlForm.NotifyHost(System.String) method of the Microsoft.Office.InfoPath.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
<pre><code>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 XmlForm.NotifyHost(System.String) method of the Microsoft.Office.InfoPath.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());
}

Remarks

The XmlFormView object and its associated members are used to display InfoPath forms in a Web browser. No additional components are necessary on the desktop computer except a Web browser in order to open and fill out a form based on a browser-enabled form template.

InfoPath Forms Services uses the XmlFormView control to display forms based on form templates designed in Microsoft InfoPath so that they are browser-compatible. Developers can also use the XmlFormView control to show InfoPath forms in custom Web pages. This requires Microsoft SharePoint Server 2010 with a client access license for InfoPath Forms Services. For more information on how to develop custom Web pages with the XmlFormView control, see Hosting the InfoPath Form Editing Environment in a Custom Web Form.

Note: As an alternative to using the XmlFormView control, you can now use the BrowserFormWebPart to display InfoPath forms in SharePoint pages. For more information, see Working with the InfoPath Form Web Part.

Constructors

XmlFormView() XmlFormView() XmlFormView()

Initializes a new instance of the XmlFormView class.

Properties

DataConnectionBaseUrl DataConnectionBaseUrl DataConnectionBaseUrl

Gets or sets the base URL that will replace the specified substring of the service URL for all relative Web services in the form.

DefaultView DefaultView DefaultView

Gets or sets the default view for the form displayed in the XmlFormView control.

EditingStatus EditingStatus EditingStatus

Gets or sets the editing status of a form hosted in the XmlFormView control.

Options Options Options

Gets or sets an option, namely DisableSave, for the XmlFormView control.

PrintWindow PrintWindow PrintWindow

Gets or sets the boolean value that controls whether the print view is shown.

SaveLocation SaveLocation SaveLocation

Gets or sets the location to which the form will be saved.

ShowFooter ShowFooter ShowFooter

Gets or sets the boolean value indicating whether the footer will be displayed below the form.

ShowHeader ShowHeader ShowHeader

Gets or sets the boolean value indicating whether the header will be displayed above the form.

SubmitStatus SubmitStatus SubmitStatus

Gets the state of last submit operation.

XmlForm XmlForm XmlForm

Gets a reference to an Microsoft.Office.InfoPath.XmlForm object represents the current form and provides access to the form's main data source.

XmlLocation XmlLocation XmlLocation

Gets or sets the URL of the form template's XML file.

XsnLocation XsnLocation XsnLocation

Gets or sets the URL that specifies the location of the form template.

Methods

Dispose() Dispose() Dispose()

Enables the XmlFormView control to perform final clean up before it is released from memory.

OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs)

Use the Initialize, NotifyHost, SubmitToHost, or Close events instead of this method

OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs)

Use the Initialize, NotifyHost, SubmitToHost, or Close events instead of this method.

OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs)

Use the Initialize, NotifyHost, SubmitToHost, or Close events instead of this method.

OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs)

Use the Initialize, NotifyHost, SubmitToHost, or Close events instead of this method.

OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs)

Use the Initialize, NotifyHost, SubmitToHost, or Close events instead of this method.

RenderContents(HtmlTextWriter) RenderContents(HtmlTextWriter) RenderContents(HtmlTextWriter)

This member is reserved for internal use and is not intended to be used directly from your code.

RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter)

This member is reserved for internal use and is not intended to be used directly from your code.

Events

Close Close Close

Handles the close event of a form in a XmlFormView control.

Initialize Initialize Initialize

Handles the initialization event of a form in a XmlFormView control.

NotifyHost NotifyHost NotifyHost

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

SubmitToHost SubmitToHost SubmitToHost

Handles the submit to host event of a form in a XmlFormView control.

Applies to