J
Javi
I´m programming a composite WebCustomControl called wcc.
I want to hide a button, once it's clicked!!!
And my question is:
Is there any way to execute the OnBubbleEvent(...) method,
before than CreateChildControls() ????
If it´s impossible which is the right way to solve this
problem?
Thank´s
-----------------------
[ToolboxData("<{0}:wcc runat=server></{0}:wcc>")]
public class wcc : System.Web.UI.WebControls.WebControl,
INamingContainer
{
private bool m_bShowButton = true;
private Button cmd = null;
protected override void CreateChildControls()
{
if (this.m_bShowButton)
{
this.cmd = new Button();
this.cmd.ID = "cmd1";
this.cmd.Text = "Command Button";
this.cmd.CommandName = "Click";
Controls.Add (this.cmd);
}
else
System.Diagnostics.Debug.WriteLine
("Button Hidden");
base.CreateChildControls ();
}
protected override bool OnBubbleEvent (object sender,
System.EventArgs e)
{
if (e is CommandEventArgs)
if (((CommandEventArgs) e).CommandName
== "Click")
{
System.Diagnostics.Debug.WriteLine
("OnBubbleEvent");
this.m_bShowButton = false;
return true;
}
return false;
}
}
I want to hide a button, once it's clicked!!!
And my question is:
Is there any way to execute the OnBubbleEvent(...) method,
before than CreateChildControls() ????
If it´s impossible which is the right way to solve this
problem?
Thank´s
-----------------------
[ToolboxData("<{0}:wcc runat=server></{0}:wcc>")]
public class wcc : System.Web.UI.WebControls.WebControl,
INamingContainer
{
private bool m_bShowButton = true;
private Button cmd = null;
protected override void CreateChildControls()
{
if (this.m_bShowButton)
{
this.cmd = new Button();
this.cmd.ID = "cmd1";
this.cmd.Text = "Command Button";
this.cmd.CommandName = "Click";
Controls.Add (this.cmd);
}
else
System.Diagnostics.Debug.WriteLine
("Button Hidden");
base.CreateChildControls ();
}
protected override bool OnBubbleEvent (object sender,
System.EventArgs e)
{
if (e is CommandEventArgs)
if (((CommandEventArgs) e).CommandName
== "Click")
{
System.Diagnostics.Debug.WriteLine
("OnBubbleEvent");
this.m_bShowButton = false;
return true;
}
return false;
}
}