DataList.RenderContents Method (HtmlTextWriter)
.NET Framework (current version)
Renders the list items in the DataList control.
Assembly: System.Web (in System.Web.dll)
Parameters
- writer
-
Type:
System.Web.UI.HtmlTextWriter
A HtmlTextWriter that represents the output stream to render HTML content on the client.
The RenderContents method is used primarily by control developers, when deriving a custom control from the DataList control.
The RenderContents method renders the inner content of the DataList control, including the contained DataListItem controls.
The following code example demonstrates how to override the RenderContents method in a custom server control so that some text precedes the DataList object.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %> <%@ Page Language="VB" AutoEventWireup="True" %> <!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 DataList - RenderContents - VB.NET Example</title> </head> <body> <form id="Form1" method="post" runat="server"> <h3>Custom DataList - RenderContents - VB.NET Example</h3> <aspSample:CustomDataListRenderContents id="DataList1" 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 CustomDataListRenderContents Inherits System.Web.UI.WebControls.DataList Protected Overrides Sub RenderContents(ByVal writer As System.Web.UI.HtmlTextWriter) ' Place some text before the DataList. writer.Write("Here is some text from the RenderContent method.<br>") ' Call the base RenderContents method. MyBase.RenderContents(writer) End Sub End Class End Namespace
.NET Framework
Available since 1.1
Available since 1.1
Show: