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


このメソッドは、カスタム コントロールを RadioButtonList クラスから派生させる場合に、主に開発者によって使用されます。
RadioButtonList コントロールの Render メソッドの実装は、リストの RepeatInfo オブジェクトを初期化し、RenderRepeater メソッドを呼び出します。次にこのメソッドが RenderItem メソッドを使用して、オプション ボタンの各リスト項目を表示します。

カスタム サーバー コントロールの Render メソッドをオーバーライドして、常に RadioButtonList コントロールに説明テキストを表示する方法のコード例を次に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %> <HTML> <HEAD><title>Custom RadioButtonList - Render - VB.NET Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom RadioButtonList - Render - VB.NET Example</h3> <aspSample:CustomRadioButtonListRender id="Radiobuttonlist1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"> <asp:ListItem Value="Item1">Item1</asp:ListItem> <asp:ListItem Value="Item2">Item2</asp:ListItem> <asp:ListItem Value="Item3">Item3</asp:ListItem> <asp:ListItem Value="Item4">Item4</asp:ListItem> </aspSample:CustomRadioButtonListRender> </form> </body> </HTML> <br /><span space="preserve">...</span><br />Imports System.Web Imports System.Security.Permissions Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _ Public NotInheritable Class CustomRadioButtonListRender Inherits System.Web.UI.WebControls.RadioButtonList Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) ' Call the base RenderContents method. MyBase.Render(writer) ' Append some text to the Image. writer.Write("Experience Windows Server 2003 and Visual Studio .NET 2003.") End Sub 'Render End Class End Namespace
<%@ Page Language="C#" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %> <HTML> <HEAD> <title>Custom RadioButtonList - Render - C# Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom RadioButtonList - Render - C# Example</h3> <aspSample:CustomRadioButtonListRender id="Radiobuttonlist1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"> <asp:ListItem Value="Item1">Item1</asp:ListItem> <asp:ListItem Value="Item2">Item2</asp:ListItem> <asp:ListItem Value="Item3">Item3</asp:ListItem> <asp:ListItem Value="Item4">Item4</asp:ListItem> </aspSample:CustomRadioButtonListRender> </form> </body> </HTML> <br /><span space="preserve">...</span><br />using System.Web; using System.Security.Permissions; namespace Samples.AspNet.CS.Controls { [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class CustomRadioButtonListRender : System.Web.UI.WebControls.RadioButtonList { protected override void Render(System.Web.UI.HtmlTextWriter writer) { // Call the base RenderContents method. base.Render(writer); // Append some text to the Image. writer.Write("Experience Windows Server 2003 and Visual Studio .NET 2003."); } } }
<%@ Page Language="VJ#" AutoEventWireup="True" %> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %> <HTML> <HEAD> <title>Custom RadioButtonList - Render - VJ# Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom RadioButtonList - Render - VJ# Example</h3> <aspSample:CustomRadioButtonListRender id="Radiobuttonlist1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"> <asp:ListItem Value="Item1">Item1</asp:ListItem> <asp:ListItem Value="Item2">Item2</asp:ListItem> <asp:ListItem Value="Item3">Item3</asp:ListItem> <asp:ListItem Value="Item4">Item4</asp:ListItem> </aspSample:CustomRadioButtonListRender> </form> </body> </HTML> <br /><span space="preserve">...</span><br />package Samples.AspNet.JSL.Controls; public class CustomRadioButtonListRender extends System.Web.UI.WebControls.RadioButtonList { protected void Render(System.Web.UI.HtmlTextWriter writer) { // Call the base RenderContents method. super.Render(writer); // Append some text to the Image. writer.Write("Experience Windows Server 2003 and " + "Visual Studio .NET 2003."); } //Render } //CustomRadioButtonListRender

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


RadioButtonList クラス
RadioButtonList メンバ
System.Web.UI.WebControls 名前空間
その他の技術情報
RadioButton Web サーバー コントロールおよび RadioButtonList Web サーバー コントロール
- RadioButtonList.Render メソッドのページへのリンク