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 可用于在页面尝试导入说明文件时发生某种问题或错误时通知用户。

适用于

另请参阅