ImportCatalogPart.PartImportErrorLabelText 屬性

定義

如果在匯入處理序期間發生錯誤,則取得或設定所顯示的錯誤訊息。

public:
 property System::String ^ PartImportErrorLabelText { System::String ^ get(); void set(System::String ^ value); };
public string PartImportErrorLabelText { get; set; }
member this.PartImportErrorLabelText : string with get, set
Public Property PartImportErrorLabelText As String

屬性值

包含標籤文字的字串。 .NET Framework 會提供文化特性訊息做為預設值。

範例

下列程式碼範例示範如何以宣告方式和程式設計方式使用 PartImportErrorLabelText 屬性。 如需執行範例所需的完整程式碼和指示,請參閱類別概觀的 ImportCatalogPart 範例一節。

在下列程式碼區段中,請注意, PartImportErrorLabelText 屬性值是以宣告方式設定控制項。

<asp:CatalogZone ID="CatalogZone1" runat="server">
  <ZoneTemplate>
    <asp:ImportCatalogPart ID="ImportCatalogPart1" 
      runat="server" 
      Title="My ImportCatalogPart" 
      OnPreRender="ImportCatalogPart1_PreRender"
      BrowseHelpText="Type a path or browse to find a control's 
        description file." 
      UploadButtonText="Upload Description File" 
      UploadHelpText="Click the button to upload the description 
        file."
      ImportedPartLabelText="My User Information WebPart" 
      PartImportErrorLabelText="An error occurred while trying 
        to import a description file."  />
  </ZoneTemplate>
</asp:CatalogZone>
<asp:CatalogZone ID="CatalogZone1" runat="server">
  <ZoneTemplate>
    <asp:ImportCatalogPart ID="ImportCatalogPart1" 
      runat="server" 
      Title="My ImportCatalogPart" 
      OnPreRender="ImportCatalogPart1_PreRender"
      BrowseHelpText="Type a path or browse to find a control's 
        description file." 
      UploadButtonText="Upload Description File" 
      UploadHelpText="Click the button to upload the description 
        file."
      ImportedPartLabelText="My User Information WebPart" 
      PartImportErrorLabelText="An error occurred while trying 
        to import a description file."  />
  </ZoneTemplate>
</asp:CatalogZone>

在程式碼的這個區段中, PartImportErrorLabelText 會以程式設計方式指派屬性值。

protected void Button1_Click(object sender, EventArgs e)
{
  ImportCatalogPart1.Title = "Import Server Controls";
  ImportCatalogPart1.BrowseHelpText = "Enter the path to a "
    + "description file.";
  ImportCatalogPart1.UploadButtonText = "Upload Description";
  ImportCatalogPart1.UploadHelpText = "Upload a description file.";
  ImportCatalogPart1.ImportedPartLabelText = "Imported Controls";
  ImportCatalogPart1.PartImportErrorLabelText = "An error occurred " 
    + "during the import process.";

}
Protected Sub Button1_Click(ByVal sender As Object, _
  ByVal e As EventArgs)
    ImportCatalogPart1.Title = "Import Server Controls"
    ImportCatalogPart1.BrowseHelpText = "Enter the path to a " _
      & "description file."
    ImportCatalogPart1.UploadButtonText = "Upload Description"
    ImportCatalogPart1.UploadHelpText = "Upload a description file."
    ImportCatalogPart1.ImportedPartLabelText = "Imported Controls"
    ImportCatalogPart1.PartImportErrorLabelText = "An error occurred " _
      & "during the import process."
End Sub

當您在瀏覽器中載入頁面時,您可以使用 [顯示模式 ] 下拉式清單控制項來選取 [目錄模式 ],並將頁面切換為目錄模式。 在目錄模式中的頁面和上傳的描述檔案時,請注意使用者介面中顯示的各種文字字串, (UI) 控制項 ImportCatalogPart 。 如果您按一下 [ 上傳描述檔案 ] 按鈕,UI 中數個屬性的文字會變更,包括屬性的 PartImportErrorLabelText 文字。

備註

當頁面嘗試匯入描述檔時發生某些問題或錯誤時,屬性 PartImportErrorLabelText 很適合用來通知使用者。

適用於

另請參閱