共用方式為


XmlFormView class

用來在瀏覽器中顯示 InfoPath 表單的主要 ASP.NET 控制項。

Inheritance hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Panel
        System.Web.UI.WebControls.WebParts.Part
          System.Web.UI.WebControls.WebParts.WebPart
            Microsoft.Office.InfoPath.Server.Controls.XmlFormView

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

Syntax

'宣告
<MdsCompliantAttribute(IsCompliant := False)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class XmlFormView _
    Inherits WebPart _
    Implements INamingContainer
'用途
Dim instance As XmlFormView
[MdsCompliantAttribute(IsCompliant = false)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class XmlFormView : WebPart, 
    INamingContainer

備註

XmlFormView物件以及其相關的成員可用來在網頁瀏覽器中顯示 InfoPath 表單。除了才能開啟及填寫表單的瀏覽器的表單範本為基礎的網頁瀏覽器桌上型電腦上都沒有其他元件。

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.

注意事項注意事項

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.

Examples

在下列範例中, XmlFormView控制項, XmlFormView1,架設在自訂的網頁,並包含位於同一個網站上的瀏覽器的表單範本。NotifyHost控制項的事件XmlFormView用來填入控制項而言, TextBox1,在 [自訂] 網頁。

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

需要將值從主要資料來源中的表單, my:field2,傳送到裝載的網頁上的表單程式碼會使用NotifyHost方法中的Microsoft.Office.InfoPath命名空間提供之XmlForm物件在此例中從表單中的按鈕。

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();
}

需要將值從主要資料來源中的表單, my:field2,傳送到裝載的網頁上的表單程式碼會使用NotifyHost方法中的Microsoft.Office.InfoPath命名空間提供之XmlForm物件在此例中從表單中的按鈕。

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());
}

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

請參閱

參照

XmlFormView members

Microsoft.Office.InfoPath.Server.Controls namespace