自定义控件嵌套
public class DisplayPost : System.Web.UI.WebControls.WebControl,INamingContainer
{
protected UC_Button SendMS = new UC_Button();
private void SendMS_ButtonClick(object sender, EventArgs e)
{
UC_Button ServerPromptTmp = (UC_Button)sender;
string ActionFlag = ServerPromptTmp.Value;
}
protected override void CreateChildControls()
{
SendMS.ButtonClick +=new EventHandler(SendMS_ButtonClick);
Controls.Add(SendMS);
base.CreateChildControls();
}
protected override void Render(HtmlTextWriter output)
{
this.SendMS.RenderControl(output);
}
private void DisplayPost_PreRender(object sender,EventArgs e)
{
this.SendMS.ButtonType = "LinkButton";
this.SendMS.ButtonCss = "black";
}
override protected void OnInit(EventArgs e)
{
this.PreRender += new EventHandler(DisplayPost_PreRender);
base.OnInit(e);
}
}
{
protected UC_Button SendMS = new UC_Button();
private void SendMS_ButtonClick(object sender, EventArgs e)
{
UC_Button ServerPromptTmp = (UC_Button)sender;
string ActionFlag = ServerPromptTmp.Value;
}
protected override void CreateChildControls()
{
SendMS.ButtonClick +=new EventHandler(SendMS_ButtonClick);
Controls.Add(SendMS);
base.CreateChildControls();
}
protected override void Render(HtmlTextWriter output)
{
this.SendMS.RenderControl(output);
}
private void DisplayPost_PreRender(object sender,EventArgs e)
{
this.SendMS.ButtonType = "LinkButton";
this.SendMS.ButtonCss = "black";
}
override protected void OnInit(EventArgs e)
{
this.PreRender += new EventHandler(DisplayPost_PreRender);
base.OnInit(e);
}
}