WebPart.Subtitle プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPart.Subtitle プロパティの意味・解説 

WebPart.Subtitle プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

Title プロパティ値と連結されWebPart コントロールの完全なタイトル形成する文字列取得します

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説
使用例使用例

カスタム WebPart コントロールインスタンスサブタイトル提供する方法次のコード例示します

この例の最初部分には、TextDisplayWebPart という名前のカスタム コントロールコード含まれています。このコントロールは、カスタム コントロールインスタンスに対して架空会社名を含む標準サブタイトル提供するように、さらに Subtitle プロパティオーバーライドすることを除いてWebPart クラス概要の「使用例」にあるカスタム コントロールと同じです。コード例実行するためには、このソース コードコンパイルする必要があります。それを明示的にコンパイルし、コンパイル済みアセンブリWeb サイトBin フォルダまたはグローバル アセンブリ キャッシュ配置できますサイトの App_Code フォルダソース コード配置し実行時動的にコンパイルすることもできます。このコード例は、ソース コードアセンブリコンパイルし、それを各自Web アプリケーションBin サブフォルダ配置しアセンブリ各自Web ページRegister ディレクティブ参照することを前提にしています。両方コンパイル方法を示すチュートリアルについては、「チュートリアル : カスタム サーバー コントロール開発と使用」を参照してください

Imports System
Imports System.Security.Permissions 
Imports System.Web
Imports System.Web.UI.WebControls 
Imports System.Web.UI.WebControls.WebParts

Namespace Samples.AspNet.VB.Controls

<AspNetHostingPermission(SecurityAction.Demand, _ 
  Level := AspNetHostingPermissionLevel.Minimal)> _ 
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
  Level := AspNetHostingPermissionLevel.Minimal)> _ 
Public Class TextDisplayWebPart 
  Inherits WebPart
  Private _contentText As String
 = Nothing
  Private input As TextBox
  Private DisplayContent As Label 
  Private Const _subTitle as
 String = "Contoso, Ltd"
  
  
  Public Sub New()  
    Me.AllowClose = False 
  End Sub 
  
  <Personalizable(), WebBrowsable()>  _ 
  Public Property ContentText() As
 String 
    Get 
      Return _contentText 
    End Get 
    Set 
      _contentText = value
    End Set 
  End Property
    
  Protected Overrides Sub
 CreateChildControls() 
    Controls.Clear()
    DisplayContent = New Label()
    DisplayContent.Text = Me.ContentText
    DisplayContent.BackColor = _
      System.Drawing.Color.LightBlue
    Me.Controls.Add(DisplayContent) 
    input = New TextBox() 
    Me.Controls.Add(input)
    Dim update As New Button()
    update.Text = "Set Label Content" 
    AddHandler update.Click, AddressOf Me.submit_Click
    Me.Controls.Add(update) 
    ChildControlsCreated = True 
  
  End Sub 
  
  Public Overrides ReadOnly
 Property Subtitle() As String
    Get
      Return _subTitle 
    End Get
  End Property

  Private Sub submit_Click(ByVal
 sender As Object, _
                           ByVal e As EventArgs)
  
    ' Update the label string.
    If input.Text <> String.Empty Then
      _contentText = input.Text & "<br />"
      input.Text = String.Empty 
      DisplayContent.Text = Me.ContentText
    End If
  
  End Sub 
  
End Class 

End Namespace 
using System;
using System.Security.Permissions;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, 
    Level=AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand, 
    Level=AspNetHostingPermissionLevel.Minimal)]
  public class TextDisplayWebPart : WebPart
  {
    private String _contentText = null;
    TextBox input;
    Label DisplayContent;
    const string _subTitle = "Contoso,
 Ltd";

    public TextDisplayWebPart()
    {
      this.AllowClose = false;
    }

    [Personalizable(), WebBrowsable]
    public String ContentText
    {
      get { return _contentText; }
      set { _contentText = value; }
    }

    protected override void CreateChildControls()
    {
      Controls.Clear();
      DisplayContent = new Label();
      DisplayContent.BackColor = 
        System.Drawing.Color.LightBlue;
      DisplayContent.Text = this.ContentText;
      this.Controls.Add(DisplayContent);
      input = new TextBox();
      this.Controls.Add(input);
      Button update = new Button();
      update.Text = "Set Label Content";
      update.Click += new EventHandler(this.submit_Click);
      this.Controls.Add(update);
      ChildControlsCreated = true;
    }
    
    public override string Subtitle
    {
      get {return _subTitle; }
    }

    private void submit_Click(object sender,
 EventArgs e)
    {
      // Update the label string.
      if (input.Text != String.Empty)
      {
        _contentText = input.Text + @"<br />";
        input.Text = String.Empty;
        DisplayContent.Text = this.ContentText;
      }
    }
  }
}
package Samples.AspNet.JSL.Controls;

import System.* ;
import System.Security.Permissions.*;
import System.Web.*;
import System.Web.UI.WebControls.*;
import System.Web.UI.WebControls.WebParts.*;

/** @attribute AspNetHostingPermission(SecurityAction.Demand, Level =
    AspNetHostingPermissionLevel.Minimal)
 */
/** @attribute AspNetHostingPermission(SecurityAction.InheritanceDemand, Level =
    AspNetHostingPermissionLevel.Minimal)
 */
public class TextDisplayWebPart extends WebPart
{
    private String _contentText = null;
    private TextBox input;
    private Label displayContent;
    private String _subTitle = "Contoso, Ltd";

    public TextDisplayWebPart()
    {
        this.set_AllowClose(false);
    } //TextDisplayWebPart

    /** @attribute Personalizable()
        @attribute WebBrowsable()
     */
    /** @property
     */
    public String get_ContentText()
    {
        return _contentText;
    } //get_ContentText

    /** @property 
     */
    public void set_ContentText(String value)
    {
        _contentText = value;
    } //set_ContentText

    protected void CreateChildControls()
    {
        get_Controls().Clear();
        displayContent = new Label();
        displayContent.set_BackColor(System.Drawing.Color.get_LightBlue());
        displayContent.set_Text(this.get_ContentText());
        this.get_Controls().Add(displayContent);
        input = new TextBox();
        this.get_Controls().Add(input);
        Button update = new Button();
        update.set_Text("Set Label Content");
        update.add_Click(new EventHandler(this.Submit_Click));
        this.get_Controls().Add(update);
        set_ChildControlsCreated(true);
    } //CreateChildControls

    /** @property 
     */
    public String get_Subtitle()
    {
        return _subTitle;
    } //get_Subtitle

    private void Submit_Click(Object sender,
 EventArgs e)
    {
        // Update the label string.
        if (!(input.get_Text().Equals(""))) {
            _contentText = input.get_Text() + "<br />";
            input.set_Text("");
            displayContent.set_Text(this.get_ContentText());
        }
    } //Submit_Click
} //TextDisplayWebPart

例の 2 番目の部分は、ASP.NET Web ページTextDisplayWebPart コントロール参照する方法を示す Web ページです。ブラウザページ読み込むと、コントロールタイトル バーテキストに、宣言マークアップコントロール代入したタイトルハイフン (-) 区切り記号、および TextDisplayWebPart コントロールカスタム サブタイトルの値が表示されます。

<%@ page language="VB" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.VB.Controls"
 
             Assembly="TextDisplayWebPartVB"%>

<html>
<head id="Head1" runat="server">
  
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1"
 runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc"
 />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text WebPart" 
            />
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="C#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.CS.Controls" 
             Assembly="TextDisplayWebPartCS"%>

<html>
<head id="Head1" runat="server">
  
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server"
 />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc"
 />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text WebPart" 
            />
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VJ#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.JSL.Controls" 
             Assembly="TextDisplayWebPartJSL"%>

<html>
<head id="Head1" runat="server">
  
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server"
 />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc"
 />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text WebPart" 
            />
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からWebPart.Subtitle プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からWebPart.Subtitle プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からWebPart.Subtitle プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

WebPart.Subtitle プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebPart.Subtitle プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS