Hi,
I have created a web control library project.
I created a button as follows:
Button btnAssign = new Button();
btnAssign.CausesValidation = false;
btnAssign.ID = "As1";
btnAssign.Text = "...";
btnAssign.Font.Name = "Arial";
btnAssign.ForeColor = Color.Gray;
btnAssign.Click += new EventHandler(this.btnAssign_Click);
and added it into a panel myPanel
myPanel.Controls.Add(btnAssign);
The rendering was done as follows:
protected override void RenderContents(HtmlTextWriter output)
{
AddAttributesToRender(output);
myPanel.RenderControl(output);
}
I have added a trace just to see whether it enters btnAssign_Click or not
private void btnAssign_Click(object sender, System.EventArgs e)
{
Page.Trace.Warn("btnAssign_Click");
}
I created a web project to test the control and set the trace to true:
protected void Page_Load(object sender, EventArgs e)
{
WCL.myClass dc = new WCL. myClass();
//Add to phDC place holder
phDC.Controls.Add(dc);
}
When the test page is loaded the button from the web control library appears.
When I click it nothing happens (does not enter btnAssign_Click).
Is there anything else I need to do?
Please help
Thanks