A custom composite control that combines a literal control with a TextBox control
Source: Internet
Author: User
This control primarily resolves a client-side validation script in a custom composite control.
Using System;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.ComponentModel;
Namespace Only.compositioncontrols
{
<summary>
Create by Liyi.
Date:2004-10-10
</summary>
[Defaultproperty ("value"), ValidationPropertyAttribute ("value"), ToolBoxData ("<{0}:literaltextbox runat=server ></{0}:LiteralTextBox> ")]
public class Literaltextbox:control,inamingcontainer
{
The following script is used to enter page numbers from a text box
[DefaultValue ("Text:"), Category ("Custom")]
public string Text
{
Get
{
This. EnsureChildControls ();
Return ((LiteralControl) controls[0]). Text;
}
Set
{
This. EnsureChildControls ();
((LiteralControl) controls[0]). Text = value;
}
}
[DefaultValue ("Value"), Category ("Custom")]
public string Value
{
Get
{
This. EnsureChildControls ();
Return ((TextBox) controls[1]). Text;
}
Set
{
This. EnsureChildControls ();
((TextBox) controls[1]). Text = value;
}
}
[DefaultValue (""), Category ("Custom")]
Public Unit Width
{
Get
{
This. EnsureChildControls ();
Return ((TextBox) controls[1]). Width;
}
Set
{
This. EnsureChildControls ();
((TextBox) controls[1]). Width = value;
}
}
[DefaultValue (TextBoxMode.SingleLine), Category ("Custom")]
Public TextBoxMode TextMode
{
Get
{
This. EnsureChildControls ();
Return ((TextBox) controls[1]). TextMode;
}
Set
{
This. EnsureChildControls ();
((TextBox) controls[1]). TextMode = value;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.