Calendar.Render メソッド
このメソッドは,.NET Framework インフラストラクチャをサポートします。独自に作成したコードから直接使用するためのものではありません。
クライアントに Calendar コントロールを表示します。
名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Protected Friend Overrides Sub Render ( _
writer As HtmlTextWriter _
)
'使用
Dim writer As HtmlTextWriter
Me.Render(writer)
protected internal override void Render (
HtmlTextWriter writer
)
protected public:
virtual void Render (
HtmlTextWriter^ writer
) override
protected void Render (
HtmlTextWriter writer
)
protected internal override function Render (
writer : HtmlTextWriter
)
適用できません。
パラメータ
- writer
クライアントに表示する出力ストリームを格納している System.Web.UI.HtmlTextWriter。
使用例
カスタム サーバー コントロールの Render メソッドをオーバーライドして、Calendar で常にイメージが表示されるようにする方法を次のコード例に示します。
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Custom Calendar - Render - VB.NET Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom Calendar - Render - VB.NET Example</h3>
<aspSample:CustomCalendarRender id="Calendar1" runat="server" />
</form>
</body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Custom Calendar - Render - C# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom Calendar - Render - C# Example</h3>
<aspSample:CustomCalendarRender
id="Calendar1"
runat="server" />
</form>
</body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Custom Calendar - Render - VJ# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom Calendar - Render - VJ# Example</h3>
<aspSample:CustomCalendarRender
id="Calendar1"
runat="server" />
</form>
</body>
</html>
Imports System.Web
Imports System.Security.Permissions
Namespace Samples.AspNet.VB.Controls
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class CustomCalendarRender
Inherits System.Web.UI.WebControls.Calendar
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
' Call the base class's Render method.
MyBase.Render(writer)
' Render a BR HTML tag
writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br)
' Create and render a new Image Web control.
Dim image As New System.Web.UI.WebControls.Image
image.ID = "Image1"
image.ImageUrl = "image.jpg"
image.AlternateText = "Image for Calendar1."
image.RenderControl(writer)
End Sub
End Class
End Namespace
using System.Web;
using System.Security.Permissions;
namespace Samples.AspNet.CS.Controls
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class CustomCalendarRender : System.Web.UI.WebControls.Calendar
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
// Call the base class's Render method.
base.Render(writer);
// Render a BR HTML tag
writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);
// Create and render a new Image Web control.
System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
image.ID = "Image1";
image.ImageUrl = "image.jpg";
image.AlternateText = "Image for Calendar1.";
image.RenderControl(writer);
}
}
}
package Samples.AspNet.JSL.Controls;
public class CustomCalendarRender
extends System.Web.UI.WebControls.Calendar
{
protected void Render(System.Web.UI.HtmlTextWriter writer)
{
// Call the base class's Render method.
super.Render(writer);
// Render a BR HTML tag
writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);
// Create and render a new Image Web control.
System.Web.UI.WebControls.Image image =
new System.Web.UI.WebControls.Image();
image.set_ID("Image1");
image.set_ImageUrl("image.jpg");
image.set_AlternateText("Image for Calendar1.");
image.RenderControl(writer);
} //Render
} //CustomCalendarRender
プラットフォーム
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
Calendar クラス
Calendar メンバ
System.Web.UI.WebControls 名前空間