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

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

HtmlInputText.OnPreRender メソッド

PreRender イベント発生させます

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

Protected Friend Overrides
 Sub OnPreRender ( _
    e As EventArgs _
)
Dim e As EventArgs

Me.OnPreRender(e)
protected internal override void OnPreRender
 (
    EventArgs e
)
protected public:
virtual void OnPreRender (
    EventArgs^ e
) override
protected void OnPreRender (
    EventArgs e
)
protected internal override function
 OnPreRender (
    e : EventArgs
)

パラメータ

e

イベント データ格納している EventArgs。

解説解説
使用例使用例

OnPreRender メソッドオーバーライドして、カスタムHtmlInputText サーバー コントロールの MaxLength プロパティに文字数として 30設定する方法次のコード例示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>

<script runat="server">

  Sub Page_Load(sender As Object,
 e As EventArgs)

    If Not Page.IsPostBack Then

      HtmlInputText1.Value = "Hello HtmlInputText World."

    End If

  End Sub

  Sub HtmlInputText1_ServerChange(sender As
 Object, e As System.EventArgs)

    Dim htmlInputText1 As System.Web.UI.HtmlControls.HtmlInputText
 = CType(sender, System.Web.UI.HtmlControls.HtmlInputText)
    Div1.InnerHtml = "Change the preceding text to:<br>"
 & htmlInputText1.Value

  End Sub

</script>

<html>
  <head>
    <title>Custom HtmlInputText OnPreRender Example</title>
  </head>

  <body>
    <form id="Form1" method="post"
 runat="server">

      <h3>Custom HtmlInputText OnPreRender Example</h3>

      <p>Make a change to the text, and
 then press the ENTER.<br>

      <aspSample:CustomHtmlInputTextOnPreRender 
        id="HtmlInputText1" 
        name="HtmlInputText1" 
        runat="server" 
        type="text"
        size="45"
        style="WIDTH: 305px; HEIGHT: 22px" 
        onserverchange="HtmlInputText1_ServerChange">

      </p>
      <p>
      <DIV 
        id="Div1" 
        runat="server" 
        style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px"
 
        ms_positioning="FlowLayout" />
      </p>
          
    </form>
  </body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

  void Page_Load(Object sender, EventArgs e) 
  {
    if (!Page.IsPostBack)
    {
      HtmlInputText1.Value = "Hello HtmlInputText World.";
    }
  }

  void HtmlInputText1_ServerChange(object sender, System.EventArgs
 e)
  {

    // Diplay the value of the selected HtmlInputText control.
    System.Web.UI.HtmlControls.HtmlInputText htmlInputText1 = (System.Web.UI.HtmlControls.HtmlInputText)
 sender;
    Div1.InnerHtml = "Change the preceding text to:<br>" + htmlInputText1.Value;

  }

</script>

<html>
  <head>
    <title>Custom HtmlInputText OnPreRender Example</title>
  </head>

  <body>
    
    <form id="Form1" method="post" runat="server">

      <h3>Custom HtmlInputText OnPreRender Example</h3>

      <p>Make a change to the text, and then press the ENTER.<br>

      <aspSample:CustomHtmlInputTextOnPreRender 
        id="HtmlInputText1" 
        name="HtmlInputText1" 
        runat="server" 
        type="text"
        size="45"
        style="WIDTH: 305px; HEIGHT: 22px" 
        onserverchange="HtmlInputText1_ServerChange">

      </p>
      <p>
      <DIV 
        id="Div1" 
        runat="server" 
        style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px" 
        ms_positioning="FlowLayout" />
      </p>
          
    </form>
  </body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom HtmlInputText - OnPreRender - VJ# Example</title>
    <script runat="server">
    void Page_Load(Object sender, EventArgs e) 
    {
        if (!get_Page().get_IsPostBack()) {
            HtmlInputText1.set_Value("Hello HtmlInputText World.");
        }
    } //Page_Load

    void HtmlInputText1_ServerChange(Object sender, System.EventArgs
 e)
    {
        // Diplay the value of the selected HtmlInputText control.
        System.Web.UI.HtmlControls.HtmlInputText htmlInputText1 = 
            (System.Web.UI.HtmlControls.HtmlInputText)sender;
        Div1.set_InnerHtml("You change the above text to:<br>" 
            + htmlInputText1.get_Value());
    } //HtmlInputText1_ServerChange
    </script>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom HtmlInputText - OnPreRender - VJ# Example</h3>
      <p>Make a change to the text, then press the Enter key.<br>
        <aspSample:CustomHtmlInputTextOnPreRender 
          id="HtmlInputText1" 
          name="HtmlInputText1" 
          runat="server" 
          type="text"
          size="45"
          style="WIDTH: 305px; HEIGHT: 22px" 
          onserverchange="HtmlInputText1_ServerChange">
      </p>
      <p>
      <DIV 
        id="Div1" 
        runat="server" 
        style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px" 
        ms_positioning="FlowLayout" />
      </p>
          
        </form>
    </body>
</HTML>
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
Public NotInheritable Class
 CustomHtmlInputTextOnPreRender
    Inherits System.Web.UI.HtmlControls.HtmlInputText

    Protected Overrides Sub
 OnPreRender(ByVal e As System.EventArgs)

        ' Call the base class's OnPreRender method.
        MyBase.OnPreRender(e)

        ' Set the HtmlInputText object's MaxLength property to 30 characters.
        Me.MaxLength = 30
    End Sub
End Class
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomHtmlInputTextOnPreRender
 : System.Web.UI.HtmlControls.HtmlInputText
    {
        protected override void OnPreRender(System.EventArgs
 e)
        {
            // Call the base class's OnPreRender method.
            base.OnPreRender(e);

            // Set the HtmlInputText object's MaxLength property to
 30 characters.
            this.MaxLength = 30;
        }
    }
}
package Samples.AspNet.JSL.Controls;

public class CustomHtmlInputTextOnPreRender
    extends System.Web.UI.HtmlControls.HtmlInputText
{
    protected void OnPreRender(System.EventArgs
 e)
    {
        // Call the base's OnPreRender method.
        super.OnPreRender(e);
        // Set the HtmlInputText's MaxLength to 30 chars.
        this.set_MaxLength(30);
    } //OnPreRender
} //CustomHtmlInputTextOnPreRender
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS