Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. LINQ;
Using system. text;
Using system. Web;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Namespace servercontrol1
{
[Defaultproperty ("text")]
[Toolboxdata ("<{0}: servercontrol1 runat = Server> </{0}: servercontrol1>")]
Public class servercontrol1: compositecontrol, inamingcontainer
{
[Bindable (true)]
[Category ("appearance")]
[Defaultvalue ("")]
[Localizable (true)]
Public String text
{
Get
{
String S = (string) viewstate ["text"];
Return (S = NULL )? "[" + This. ID + "]": S );
}
Set
{
Viewstate ["text"] = value;
}
}
Public String tip
{
Get {return viewstate ["AA"]. tostring ();}
Set {viewstate ["AA"] = value ;}
}
Textbox tb1;
Button BTN;
Label Lb;
Protected override void createchildcontrols ()
{
Controls. Add (New literalcontrol ("Tb1 = new Textbox ();
Tb1.text = "0 ";
Controls. Add (tb1 );
BTN = new button ();
BTN. Text = "login ";
BTN. commandname = "login ";
// BTN. Click + = new eventhandler (btn_click );
Controls. Add (BTN );
Lb = new label ();
LB. Text = "aaaaaaaaa ";
Controls. Add (LB );
}
// Triggered when you click an event of the Child control in the composite control. The event bubbles.
Protected override bool onbubbleevent (Object source, eventargs E)
{
Bool handed = false;
If (E is commandeventargs)
{
Commandeventargs Ce = (commandeventargs) E;
If (Ce. commandname = "login ")
{
LB. Text = "aaaaaaaa ";
Handed = true;
}
}
Return handed;
}
Public class checkeventargs: eventargs
{
Private bool match = false;
Public checkeventargs (INT difference)
{
If (difference = 0)
{
Match = true;
}
}
Public bool match
{
Get
{
Return match;
}
}
}
Public event checkeventhandler check;
Public Delegate void checkeventhandler (Object sender, checkeventargs CE );
}
}