Aracılığıyla paylaş


TableCell.RenderContents(HtmlTextWriter) Yöntem

Tanım

TableCell İçeriği belirtilen HtmlTextWriter nesneye işler.

protected:
 override void RenderContents(System::Web::UI::HtmlTextWriter ^ writer);
protected public:
 override void RenderContents(System::Web::UI::HtmlTextWriter ^ writer);
protected override void RenderContents (System.Web.UI.HtmlTextWriter writer);
protected internal override void RenderContents (System.Web.UI.HtmlTextWriter writer);
override this.RenderContents : System.Web.UI.HtmlTextWriter -> unit
Protected Overrides Sub RenderContents (writer As HtmlTextWriter)
Protected Friend Overrides Sub RenderContents (writer As HtmlTextWriter)

Parametreler

writer
HtmlTextWriter

İstemciye HTML içeriği işleyen çıkış akışı.

Örnekler

Aşağıdaki kod örneği, özel TableCell bir denetimde özel metnin hücrenin içeriğine eklenmesi için yönteminin nasıl geçersiz kılındığını RenderContents gösterir.

<%@ Page Language="C#" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" 
    Assembly="Samples.AspNet.CS" %>
<!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 id="Head2" runat="server">
    <title>Custom TableCell - RenderContents - C# Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>Custom TableCell - RenderContents - C# Example</h3>

    <asp:Table id="Table1" runat="server" CellPadding="3" CellSpacing="2">
      <asp:TableRow>
        <aspSample:CustomTableCellRenderContents Text="(0,0)" />
        <aspSample:CustomTableCellRenderContents Text="(0,1)" />
        <aspSample:CustomTableCellRenderContents Text="(0,2)" />
      </asp:TableRow>
      <asp:TableRow>
        <aspSample:CustomTableCellRenderContents Text="(1,0)" />
        <aspSample:CustomTableCellRenderContents Text="(1,1)" />
        <aspSample:CustomTableCellRenderContents Text="(1,2)" />
      </asp:TableRow>
    </asp:Table>

    </div>
    </form>
</body>
</html>
<%@ 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 id="Head2" runat="server">
    <title>Custom TableCell - RenderContents - VB.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>Custom TableCell - RenderContents - VB.NET Example</h3>

    <asp:Table id="Table1" runat="server" CellPadding="3" CellSpacing="2">
      <asp:TableRow>
        <aspSample:CustomTableCellRenderContents Text="(0,0)" />
        <aspSample:CustomTableCellRenderContents Text="(0,1)" />
        <aspSample:CustomTableCellRenderContents Text="(0,2)" />
      </asp:TableRow>
      <asp:TableRow>
        <aspSample:CustomTableCellRenderContents Text="(1,0)" />
        <aspSample:CustomTableCellRenderContents Text="(1,1)" />
        <aspSample:CustomTableCellRenderContents Text="(1,2)" />
      </asp:TableRow>
    </asp:Table>

    </div>
    </form>
</body>
</html>
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class CustomTableCellRenderContents : System.Web.UI.WebControls.TableCell
  {
    protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
    {
      // Insert text into each TableCell.
      writer.Write("TableCell: ");

      // Call the base RenderContents method.
      base.RenderContents(writer);
    }
  }
}
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public NotInheritable Class CustomTableCellRenderContents
        Inherits System.Web.UI.WebControls.TableCell

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

            ' Insert text into each TableCell.
            writer.Write("TableCell: ")

            ' Call the base RenderContents method.
            MyBase.RenderContents(writer)

        End Sub

    End Class

End Namespace

Açıklamalar

Denetimin TableCell alt denetimleri varsa veya türetilmiş bir sınıfta geçersiz kılındıysa, temel sınıfın RenderContents yöntemi çağrılır; aksi takdirde, özelliğin Text değeri nesnesine HtmlTextWriter yazılır.

RenderContents yöntemi öncelikle denetimin işlevselliğini TableCell genişleten denetim geliştiricileri tarafından kullanılır.

Şunlara uygulanır

Ayrıca bkz.