ImportCatalogPart.Title 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定顯示在控制項標題列 ImportCatalogPart 中的標題。
public:
virtual property System::String ^ Title { System::String ^ get(); void set(System::String ^ value); };
public override string Title { get; set; }
member this.Title : string with get, set
Public Overrides Property Title As String
屬性值
一個字串,用作控制的標題。 預設值是由 Web Parts 控制集所提供的計算控制名稱。
範例
以下程式碼範例示範如何在宣告式與程式化方式使用該 Title 屬性。 關於執行範例所需的完整程式碼與指令,請參閱類別總覽中的 ImportCatalogPart 範例部分。
在接下來的程式碼段落中,注意 Title 控制項的屬性值是宣告性設定的。
<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>
在這段程式碼中, Title 屬性值是以程式方式分配的。
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 中幾個屬性的文字會被更改,包括該 Title 屬性的文字。
備註
Title當控制項在目錄模式下可見時,屬性值會顯示在控制項的ImportCatalogPart標題列中。 當控制項在頁面中宣告時,你可以透過屬性 Title 設定屬性的值。 若未提供標題值,則會使用文化特定的預設值來描述此控制項允許使用者編輯的屬性類型。