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

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

HtmlInputRadioButton.RenderAttributes メソッド

指定した HtmlTextWriter オブジェクトに、HtmlInputRadioButton コントロール属性レンダリングます。

名前空間: System.Web.UI.HtmlControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Overrides Sub
 RenderAttributes ( _
    writer As HtmlTextWriter _
)
Dim writer As HtmlTextWriter

Me.RenderAttributes(writer)
protected override void RenderAttributes (
    HtmlTextWriter writer
)
protected:
virtual void RenderAttributes (
    HtmlTextWriter^ writer
) override
protected void RenderAttributes (
    HtmlTextWriter writer
)
protected override function RenderAttributes
 (
    writer : HtmlTextWriter
)

パラメータ

writer

表示される出力受け取る HtmlTextWriter。

解説解説

RenderAttributes メソッドは、Value プロパティHtmlInputRadioButton コントロール属性として書き込み基本クラスの RenderAttributes メソッド呼び出します。

RenderAttributes メソッドは、主に、コントロール開発者HtmlInputRadioButton コントロール機能拡張する際に使用します

使用例使用例

カスタム サーバー コントロールRenderAttributes メソッドオーバーライドして、特定のタイトル テキストが常に HtmlInputRadioButton表示されるようにする方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Samples"
 Assembly="Samples.AspNet.VB"
 %>
<HTML>
  <HEAD><title>Custom HtmlInputRadioButton - RenderAttributes - 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 - Method - Visual Basic RenderAttributes</h3>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton1" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" checked
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange"
 
        value="HtmlInputRadioButton1">HtmlInputRadioButton1
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes>
      <br>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton2" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" 
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange"
 
        value="HtmlInputRadioButton2">HtmlInputRadioButton2
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes><br>

      <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.Samples"
 Assembly="Samples.AspNet.CS" %>
<HTML>
  <HEAD><title>Custom HtmlInputRadioButton - RenderAttributes - 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 - Method - C# RenderAttributes</h3>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton1" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" checked
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange" 
        value="HtmlInputRadioButton1">HtmlInputRadioButton1
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes>
      <br>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton2" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" 
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange" 
        value="HtmlInputRadioButton2">HtmlInputRadioButton2
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes><br>

      <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.Samples"
 Assembly="Samples.AspNet.JSl" %>
<HTML>
  <HEAD><title>Custom HtmlInputRadioButton - RenderAttributes - 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 - Method - VJ# RenderAttributes</h3>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton1" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" checked
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange" 
        value="HtmlInputRadioButton1">HtmlInputRadioButton1
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes>
      <br>

      <aspSample:CustomHtmlInputRadioButtonRenderAttributes 
        id="HtmlInputRadioButton2" 
        name="HtmlInputRadioButtonGroup1" 
        runat="server" 
        type="radio" 
        onserverchange="HtmlInputRadioButtonGroup1_ServerChange" 
        value="HtmlInputRadioButton2">HtmlInputRadioButton2
      </aspSample:CustomHtmlInputRadioButtonRenderAttributes><br>

      <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>
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Samples
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomHtmlInputRadioButtonRenderAttributes
        Inherits System.Web.UI.HtmlControls.HtmlInputRadioButton

        Protected Overrides Sub
 RenderAttributes(ByVal writer As System.Web.UI.HtmlTextWriter)

            ' Call the base class's RenderAttributes method.
            MyBase.RenderAttributes(writer)

            ' Write out the control's Title tag.
            writer.Write((" Title=""Option
 " + Me.Value + """"))

        End Sub
    End Class
End Namespace

using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Samples
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomHtmlInputRadioButtonRenderAttributes
 : System.Web.UI.HtmlControls.HtmlInputRadioButton
    {
        protected override void RenderAttributes(System.Web.UI.HtmlTextWriter
 writer)
        {
            
            // Call the base class's RenderAttributes method.
            base.RenderAttributes(writer);

            // Write out the control's Title tag.
            writer.Write(" Title=\"Option " + this.Value
 + "\"");
        }
    }
}
package Samples.AspNet.JSl.Samples;

public class CustomHtmlInputRadioButtonRenderAttributes
    extends System.Web.UI.HtmlControls.HtmlInputRadioButton
{
    protected void RenderAttributes(System.Web.UI.HtmlTextWriter
 writer)
    {
        // Call the base class's RenderAttributes method.
        super.RenderAttributes(writer);
        // Write out the control's Title tag.
        writer.Write(" Title=\"Option " + this.get_Value()
 + "\"");
    } //RenderAttributes
} //CustomHtmlInputRadioButtonRenderAttributes
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlInputRadioButton クラス
HtmlInputRadioButton メンバ
System.Web.UI.HtmlControls 名前空間
その他の技術情報
HTML サーバー コントロール



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS