Export (0) Print
Expand All

ITextControl Interface

Defines the interface a control implements to get or set its text content.

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

public interface ITextControl
public interface ITextControl
public interface ITextControl
Not applicable.

The ITextControl interface defines the Text property a control implements to allow the getting or setting of its text content. The Text property can be set programmatically or through user input.

Caution noteCaution:

A control implementing this interface can be used to display user input. Before displaying user input, the input must be checked for malicious client script, such as executable script or SQL statements. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see Validation Server Controls.

The following code example shows a custom control that implements the ITextControl interface. A default value is assigned to the Text property if a null reference (Nothing in Visual Basic) is passed to the property.


public class CustomTextControl : Control, ITextControl
{
    private string _text;

	public CustomTextControl()
	{
	}

    public string Text
    {
        get
        {
            return _text;
        }
        set
        {
            if (value != null)
            {
                _text = value;
            }
            else
            {
                _text = "No Value.";
            }
        }
    }

    // Provide the remaining code to implement a text control.
}

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:
© 2014 Microsoft