TextBox.AddParsedSubObject メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TextBox.AddParsedSubObject メソッドの意味・解説 

TextBox.AddParsedSubObject メソッド

リテラル コントロールだけを Text プロパティとして追加できるようにオーバーライドされます

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

Protected Overrides Sub
 AddParsedSubObject ( _
    obj As Object _
)
Dim obj As Object

Me.AddParsedSubObject(obj)
protected override void AddParsedSubObject
 (
    Object obj
)
protected:
virtual void AddParsedSubObject (
    Object^ obj
) override
protected void AddParsedSubObject (
    Object obj
)
protected override function AddParsedSubObject
 (
    obj : Object
)

パラメータ

obj

解析され要素を表す Object

使用例使用例

カスタム サーバー コントロールAddParsedSubObject メソッドオーバーライドして、解析するオブジェクトLiteral コントロール場合は、Text プロパティ解析するオブジェクトText プロパティを必ず設定しそれ以外場合例外スローする方法次のコード例示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>
<HTML>
    <HEAD>
        <title>Custom TextBox - AddParsedSubObject - VB.NET Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post"
 runat="server">
            <h3>Custom TextBox - AddParsedSubObject - VB.NET Example</h3>
            
            <aspSample:CustomTextBoxAddParsedSubObject id="TextBox1"
 
             runat="server">Hello World!</aspSample:CustomTextBoxAddParsedSubObject>
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - AddParsedSubObject - C# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom TextBox - AddParsedSubObject - C# Example</h3>
            
            <aspSample:CustomTextBoxAddParsedSubObject 
              id="TextBox1" 
              runat="server">Hello World!
            </aspSample:CustomTextBoxAddParsedSubObject>
            
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - AddParsedSubObject - VJ# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="get" runat="server"
 title="Custom TextBox - AddParsedSubObject - VJ# Example" language="VJ#">
            <h3>Custom TextBox - AddParsedSubObject - VJ# Example</h3>
            
            <aspSample:CustomTextBoxAddParsedSubObject 
              id="TextBox1" 
              runat="server"
              text="Hello World!">
            </aspSample:CustomTextBoxAddParsedSubObject>
            
        </form>
    </body>
</HTML>
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomTextBoxAddParsedSubObject
        Inherits System.Web.UI.WebControls.TextBox

        Protected Overrides Sub
 AddParsedSubObject(ByVal obj As Object)

            ' If the object is a LiteralControl, then set this control's
 Text property.
            If TypeOf obj Is
 System.Web.UI.LiteralControl Then
                Me.Text = CType(obj, System.Web.UI.LiteralControl).Text
            Else
                Throw New System.Web.HttpException("You
 cannot have children controls of type " + obj.GetType().Name.ToString())
            End If
        End Sub
    End Class
End Namespace
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class CustomTextBoxAddParsedSubObject
 : System.Web.UI.WebControls.TextBox
  {
    protected override void AddParsedSubObject(object
 obj)
    {
      // If the object is a LiteralControl, then set this control's
 Text property.
      if (obj is System.Web.UI.LiteralControl) 
      {
        this.Text = ((System.Web.UI.LiteralControl)obj).Text;
      }
      else 
      {
        throw new System.Web.HttpException("You cannot have
 a child control of type " + obj.GetType().Name.ToString());
      }
    }
  }
}
package Samples.AspNet.JSL.Controls; 

public class CustomTextBoxAddParsedSubObject
    extends System.Web.UI.WebControls.TextBox
{
    protected void AddParsedSubObject(Object
 obj) 
        throws System.Web.HttpException
    {
        // If the object is a LiteralControl, then set this control's
 
        // Text property.
        if (obj instanceof System.Web.UI.LiteralControl) {
            this.set_Text(((System.Web.UI.LiteralControl)obj).get_Text());
        }
        else {
            throw new System.Web.HttpException("You cannot
 have a child "
                + "control of type " 
                + obj.GetType().get_Name().ToString());
        }
    } //AddParsedSubObject
} //CustomTextBoxAddParsedSubObject
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

TextBox.AddParsedSubObject メソッドのお隣キーワード
検索ランキング

   

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



TextBox.AddParsedSubObject メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS