ValidationSummary.Render Method

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

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

protected public:
virtual void Render (
	HtmlTextWriter^ writer
) override
protected void Render (
	HtmlTextWriter writer
)
protected internal override function Render (
	writer : HtmlTextWriter
)

Parameters

writer

The output stream that renders HTML content to the client.

The following code example demonstrates how to override the Render method in a custom server control so that the ValidationSummary control is surrounded by a Small tag.

No code example is currently available or this language may not be supported.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
	<HEAD>
		<title>Custom ValidationSummary - Render - VJ# Example</title>
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<h3>Custom ValidationSummary - Render - VJ# Example</h3>

      <TABLE id="Table1" cellPadding="4" cellspacing="0">
        <TR>
          <TD>
            <TABLE id="Table2" cellPadding="4" cellspacing="0" bgColor="#eeeeee">
              <TR>
                <TD colSpan="3"><B>Credit Card Information</B> </TD>
              </TR>
              <TR>
                <TD align="right">Card Type: </TD>
                <TD>
                  <asp:RadioButtonList id="RadioButtonList1" runat="server" RepeatLayout="Flow">
                      <asp:ListItem>MasterCard</asp:ListItem>
                      <asp:ListItem>Visa</asp:ListItem>
                  </asp:RadioButtonList>
                </TD>
                <TD align="center" rowSpan="1">
                  <asp:RequiredFieldValidator 
                    id="RequiredFieldValidator1" 
                    runat="server" 
                    ErrorMessage="Card Type" 
                    Width="100%" 
                    Display="Static" 
                    ControlToValidate="RadioButtonList1">*
                  </asp:RequiredFieldValidator>
                </TD>
              </TR>
              <TR>
                <TD align="right">Card Number: </TD>
                <TD><asp:TextBox id="TextBox1" runat="server"></asp:TextBox></TD>
                <TD>
                  <asp:RequiredFieldValidator 
                    id="RequiredFieldValidator2" 
                    runat="server" 
                    ErrorMessage="Card Number" 
                    Width="100%" 
                    Display="Static" 
                    ControlToValidate="TextBox1">*
                  </asp:RequiredFieldValidator>
                </TD>
              </TR>
              <TR>
                <TD></TD>
                <TD><asp:Button id="Button1" runat="server" text="Validate"></asp:Button></TD>
                <TD></TD>
              </TR>
            </TABLE>
          </TD>
        </TR>
        <TR>
          <TD vAlign="top">
            <aspSample:CustomValidationSummaryRender
              id="ValidationSummary1" 
              runat="server" 
              DisplayMode="BulletList" 
              HeaderText="You must enter a value in the following fields:" />
          </TD>
        </TR>
      </TABLE>

		</form>
	</body>
</HTML>
...package Samples.AspNet.JSL.Controls; 

public class CustomValidationSummaryRender
    extends System.Web.UI.WebControls.ValidationSummary
{
    protected void Render(System.Web.UI.HtmlTextWriter writer)
    {
        // Write out begining Small HTML tag.
        writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Small);
        // Call the base class's Render method.
        super.Render(writer);
        // Write out ending Small HTML tag.
        writer.RenderEndTag();
    } //Render
} //CustomValidationSummaryRender

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: