XhtmlTextWriter.IsValidFormAttribute Method

Checks an XHTML attribute to ensure that it can be rendered in the opening tag of a <form> element.

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

public:
virtual bool IsValidFormAttribute (
	String^ attributeName
) override
public boolean IsValidFormAttribute (
	String attributeName
)
public override function IsValidFormAttribute (
	attributeName : String
) : boolean
Not applicable.

Parameters

attributeName

The attribute name to check.

Return Value

true if the attribute can be applied to a <form> element; otherwise, false.

This method is useful to conditionally render an attribute depending on whether it is supported by the XHTML document type of the requesting device.

The following code example is part of a larger example that creates a custom Label control and an adapter that renders the content of the control as XHTML.

This code example demonstrates how to create a Boolean variable named attTest and set it to the return value that results from calling the IsValidFormAttribute method with the parameter value "style". If the IsValidFormAttribute method returns true, the styles that are associated with the control are rendered using the HtmlTextWriter.EnterStyle and HtmlTextWriter.ExitStyle methods. If the attTest value is false, the styles are not rendered. Instead, the page displays the text for the control, a <br/> element that is rendered by the WriteBreak method, and a text string informing the user that the XHTML content of the control has rendered conditionally.

This code example is part of a larger example provided for the XhtmlTextWriter class.

No code example is currently available or this language may not be supported.

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

Community Additions

ADD
Show: