AddParsedSubObject Method

Xml.AddParsedSubObject Method (Object)

 

Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

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

protected override void AddParsedSubObject(
	object obj
)

Parameters

obj
Type: System.Object

An Object that represents the parsed element.

Exception Condition
HttpException

obj is not of type LiteralControl.

The following code example demonstrates how to override the AddParsedSubObject method in a custom Xml server control.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" 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 Xml - AddParsedSubObject - C# Example</title>
  </head>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom Xml - AddParsedSubObject - C# Example</h3>

            <aspSample:CustomXmlAddParsedSubObject id="xml1" runat="server" 
             DocumentSource="People.xml" TransformSource="PeopleTable.xslt" />
        </form>
    </body>
</html>
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomXmlAddParsedSubObject : System.Web.UI.WebControls.Xml
    {
        protected override void AddParsedSubObject(object obj)
        {
            // Call the base AddParseSubObject method.
            base.AddParsedSubObject(obj);

            // Note: This method does not get called when transforming XML.
        }
    }
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft