HtmlInputRadioButton.OnPreRender メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim e As EventArgs Me.OnPreRender(e)

OnPreRender メソッドは、HtmlInputRadioButton コントロールをレンダリングする直前に呼び出されます。
OnPreRender メソッドは、主に、コントロール開発者が HtmlInputRadioButton コントロールの機能を拡張する際に使用します。

OnPreRender メソッドをオーバーライドして、カスタムの HtmlInputRadioButton サーバー コントロールに Title 属性を追加する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %> <HTML> <HEAD><title>Custom HtmlInputRadioButton - OnPreRender - Visual Basic Example</title> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Div1.InnerHtml = "" End Sub Sub HtmlInputRadioButtonGroup1_ServerChange(sender As Object, e As System.EventArgs) Dim htmlInputRadioButtonGroup1 As System.Web.UI.HtmlControls.HtmlInputRadioButton = CType(sender, System.Web.UI.HtmlControls.HtmlInputRadioButton) Div1.InnerHtml = "You change your selection to: " & htmlInputRadioButtonGroup1.Value End Sub </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom HtmlInputRadioButton - OnPreRender - Visual Basic Example</h3> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton1" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" checked onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton1">HtmlInputRadioButton1 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <br> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton2" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton2">HtmlInputRadioButton2 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <p> <input type="submit" value="Submit" id="Submit1" name="Submit1" runat="server"> </p> <DIV id="Div1" runat="server" style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px" ms_positioning="FlowLayout" /> </form> </body> </HTML>
<%@ Page Language="C#" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %> <HTML> <HEAD><title>Custom HtmlInputRadioButton - OnPreRender - C# Example</title> <script runat="server"> void Page_Load(Object sender, EventArgs e) { Div1.InnerHtml = ""; } void HtmlInputRadioButtonGroup1_ServerChange(object sender, System.EventArgs e) { // Diplay the value of the selected HtmlInputRadioButton control. System.Web.UI.HtmlControls.HtmlInputRadioButton htmlInputRadioButtonGroup1 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) sender; Div1.InnerHtml = "You change your selection to: " + htmlInputRadioButtonGroup1.Value; } </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom HtmlInputRadioButton - OnPreRender - C# Example</h3> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton1" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" checked onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton1">HtmlInputRadioButton1 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <br> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton2" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton2">HtmlInputRadioButton2 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <p> <input type="submit" value="Submit" id="Submit1" name="Submit1" runat="server"> </p> <DIV id="Div1" runat="server" style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px" ms_positioning="FlowLayout" /> </form> </body> </HTML>
<%@ Page Language="VJ#" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %> <HTML> <HEAD><title>Custom HtmlInputRadioButton - OnPreRender - VJ# Example</title> <script runat="server"> void Page_Load(Object sender, EventArgs e) { Div1.set_InnerHtml(""); } //Page_Load void HtmlInputRadioButtonGroup1_ServerChange(Object sender , System.EventArgs e) { // Diplay the value of the selected HtmlInputRadioButton control. System.Web.UI.HtmlControls.HtmlInputRadioButton htmlInputRadioButtonGroup1 = (System.Web.UI.HtmlControls. HtmlInputRadioButton)sender; Div1.set_InnerHtml("You change your selection to: " + htmlInputRadioButtonGroup1.get_Value()); } //HtmlInputRadioButtonGroup1_ServerChange </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom HtmlInputRadioButton - OnPreRender - VJ# Example</h3> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton1" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" checked onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton1">HtmlInputRadioButton1 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <br> <aspSample:CustomHtmlInputRadioButtonOnPreRender id="HtmlInputRadioButton2" name="HtmlInputRadioButtonGroup1" runat="server" type="radio" onserverchange="HtmlInputRadioButtonGroup1_ServerChange" value="HtmlInputRadioButton2">HtmlInputRadioButton2 </aspSample:CustomHtmlInputRadioButtonOnPreRender> <p> <input type="submit" value="Submit" id="Submit1" name="Submit1" runat="server"> </p> <DIV id="Div1" runat="server" style="DISPLAY: inline; WIDTH: 256px; HEIGHT: 15px" ms_positioning="FlowLayout" /> </form> </body> </HTML>
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _ Public NotInheritable Class CustomHtmlInputRadioButtonOnPreRender Inherits System.Web.UI.HtmlControls.HtmlInputRadioButton Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs) ' Run the OnPreRender method on the base class. MyBase.OnPreRender(e) ' Add a Title attribute. Me.Attributes.Add("title", "Option " + Me.Value) 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 CustomHtmlInputRadioButtonOnPreRender : System.Web.UI.HtmlControls.HtmlInputRadioButton { protected override void OnPreRender(System.EventArgs e) { // Run the OnPreRender method on the base class. base.OnPreRender(e); // Add a Title attribute. this.Attributes.Add("title", "Option " + this.Value); } } }
package Samples.AspNet.JSL.Controls; public class CustomHtmlInputRadioButtonOnPreRender extends System.Web.UI.HtmlControls.HtmlInputRadioButton { protected void OnPreRender(System.EventArgs e) { // Run the OnPreRender method on the base class. super.OnPreRender(e); // Add a Title attribute. this.get_Attributes().Add("title", "Option " + this.get_Value()); } //OnPreRender } //CustomHtmlInputRadioButtonOnPreRender

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlInputRadioButton.OnPreRender メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlInputRadioButton.OnPreRender メソッドのページへのリンク