HtmlInputRadioButton.RenderAttributes Method

Renders the HtmlInputRadioButton control attributes to the specified HtmlTextWriter object.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

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

Parameters

writer

An HtmlTextWriter that receives the rendered output.

The RenderAttributes method writes the Value property as an attribute of the HtmlInputRadioButton control and then calls the base class's RenderAttributes method

The RenderAttributes method is used primarily by control developers extending the functionality of the HtmlInputRadioButton control.

The following code example demonstrates how to override the RenderAttributes method in a custom server control so that specific title text is always displayed for the HtmlInputRadioButton.

No code example is currently available or this language may not be supported.
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Samples" Assembly="Samples.AspNet.JSl" %>
<!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 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" />
    </form>
  </body>
</html>

No code example is currently available or this language may not be supported.
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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: