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


カスタム サーバー コントロールで RenderContents メソッドをオーバーライドして、常にカスタム Button サーバー コントロールの後にテキストが表示されるようにする方法を次のコード例に示します。
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %> <%@ Page language="VB" %> <HTML> <HEAD> <title>Custom Button - RenderContents - VB.NET Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom Button - RenderContents - VB.NET Example</h3> <aspSample:CustomButtonRenderContents id="Button1" runat="server" Text="Button" /> </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 CustomButtonRenderContents Inherits System.Web.UI.WebControls.Button Protected Overrides Sub RenderContents(ByVal writer As System.Web.UI.HtmlTextWriter) MyBase.RenderContents(writer) ' Append some text after the button. writer.Write("<br>Click this button for more information.") 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 Button - RenderContents - C# Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom Button - RenderContents - C# Example</h3> <aspSample:CustomButtonRenderContents id="Button1" runat="server" Text="Button" /> </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 CustomButtonRenderContents : System.Web.UI.WebControls.Button { protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { // Call the base RenderContents method. base.RenderContents(writer); // Append some text after the button. writer.Write("<br>Click this button for more information."); } } }
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %> <%@ Page language="VJ#" %> <HTML> <HEAD> <title>Custom Button - RenderContents - VJ# Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom Button - RenderContents - VJ# Example</h3> <aspSample:CustomButtonRenderContents id="Button1" runat="server" Text="Button" /> </form> </body> </HTML> <br /><span space="preserve">...</span><br />package Samples.AspNet.JSL.Controls; public class CustomButtonRenderContents extends System.Web.UI.WebControls.Button { protected void RenderContents(System.Web.UI.HtmlTextWriter writer) { // Call the base RenderContents method. super.RenderContents(writer); // Append some text after the button. writer.Write("<br>Click this button for more information."); } //RenderContents } //CustomButtonRenderContents

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に収録されているすべての辞書からButton.RenderContents メソッドを検索する場合は、下記のリンクをクリックしてください。

- Button.RenderContents メソッドのページへのリンク