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

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

CheckBoxList.OnPreRender メソッド

クライアント表示する前に CheckBoxList コントロール構成します

名前空間: System.Web.UI.WebControls
アセンブリ: 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 メソッドは、カスタム コントロールCheckBoxList クラスから派生させる場合に、主にコントロール開発者によって使用されます。OnPreRender メソッド使用すると、デリゲート結び付けず派生クラスで PreRender イベントを処理できます派生クラスイベント処理する場合は、この手法をお勧めます。

OnPreRender メソッドは、ビューステート保存して CheckBoxList内容表示する前に必要な事前表示処理手順をすべて実行しますCheckBoxList コントロール個々リスト項目は、現在の AutoPostBack、CausesValidation、および ValidationGroup の各値を使用して表示用に初期化されます

継承時の注意 派生クラスOnPreRenderオーバーライドする場合は、登録されているデリゲートイベント受け取ることができるように、基本クラスOnPreRender メソッド呼び出してください

使用例使用例

カスタム サーバー コントロールの CreateControlStyle メソッドオーバーライドし、CheckBoxList の TableStyle クラスについて、常に新しインスタンス返されるようにする方法コード例次に示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page language="VB" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - OnPreRender - VB.NET Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post"
 runat="server">
      <h3>Custom CheckBoxList - OnPreRender - VB.NET Example</h3>
      <aspSample:CustomCheckBoxListOnPreRender id="CheckBoxList"
 runat="server"
       RepeatLayout="Table" RepeatColumns="2"
 CellSpacing="3" CellPadding="3">
                <asp:ListItem  Selected="True">Item
 1</asp:ListItem>
                <asp:ListItem>Item 2</asp:ListItem>
                <asp:ListItem>Item 3</asp:ListItem>
                <asp:ListItem>Item 4</asp:ListItem>
                <asp:ListItem>Item 5</asp:ListItem>
                <asp:ListItem>Item 6</asp:ListItem>
            </aspSample:CustomCheckBoxListOnPreRender>
    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br
 />Imports System
Imports System.Web
IMports System.Web.UI.WebControls
Imports System.Security.Permissions

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

        Protected Overrides Sub
 OnPreRender(ByVal e As EventArgs)

            ' Run the OnPreRender method on the base class.
            MyBase.OnPreRender(e)

            ' Display the CheckBoxList with a 3 point border.
            Me.BorderWidth = Unit.Point(3)
        End Sub
    End Class
End Namespace
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - OnPreRender - C# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBoxList - OnPreRender - C# Example</h3>

      <aspSample:CustomCheckBoxListOnPreRender
        id="CheckBoxList1" runat="server">
        <asp:ListItem Selected="True">Item 1</asp:ListItem>
        <asp:ListItem>Item 2</asp:ListItem>
        <asp:ListItem>Item 3</asp:ListItem>
        <asp:ListItem>Item 4</asp:ListItem>
        <asp:ListItem>Item 5</asp:ListItem>
        <asp:ListItem>Item 6</asp:ListItem>
      </aspSample:CustomCheckBoxListOnPreRender>

    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br />using
 System;
using System.Web;
using System.Web.UI.WebControls;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    public class CustomCheckBoxListOnPreRender
 : CheckBoxList
    {
        protected override void OnPreRender(EventArgs
 e)
        {
            // Run the OnPreRender method on the base class.
            base.OnPreRender(e);

            // Display the Calendar with a 3 point border.
            this.BorderWidth =  Unit.Point(3);
        }
    }
}
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - OnPreRender - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBoxList - OnPreRender - VJ# Example</h3>

      <aspSample:CustomCheckBoxListOnPreRender
        id="CheckBoxList1" runat="server">
        <asp:ListItem Selected="True">Item 1</asp:ListItem>
        <asp:ListItem>Item 2</asp:ListItem>
        <asp:ListItem>Item 3</asp:ListItem>
        <asp:ListItem>Item 4</asp:ListItem>
        <asp:ListItem>Item 5</asp:ListItem>
        <asp:ListItem>Item 6</asp:ListItem>
      </aspSample:CustomCheckBoxListOnPreRender>

    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br />package
 Samples.AspNet.JSL.Controls;

public class CustomCheckBoxListOnPreRender
    extends System.Web.UI.WebControls.CheckBoxList
{
    protected void OnPreRender(System.EventArgs
 e)
    {
        // Run the OnPreRender method on the base class.
        super.OnPreRender(e);
        // Display the Calendar with a 3 point border.
        this.set_BorderWidth(System.Web.UI.WebControls.Unit.Point(3));
    } //OnPreRender
} //CustomCheckBoxListOnPreRender
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS