B
Big D
I have a class that inherits from System.Web.Ui.Usercontrol... all is
basically is is a button which is created progammatically such as:
public abstract class BaseFrontEndEditor : System.Web.UI.UserControl
{
protected Button btnEdit = new Button();
private void Page_Load(object sender, System.EventArgs e)
{
if( ! this.IsPostBack )
{
btnEdit.Text="Edit";
btnEdit.ID = "btnEdit";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
}
}
The button is then added to the class's control collection.
I created another usercontrol that inherrits from this class, and placed it
on a page. This works, and when I view the aspx page the control is on, I
see the button. However, clicking the button never fires the event handler
("btnEdit_Click"). I have tried adding the event handler in the controls
"initializeComponent", as well as immediately after it is added (as seen
above). I have placed a simple Response.Write("hello") in the btnEdit_Click
function and nothing happens when the button is clicked. In fact, even the
button disappears. What's happening?
Thanks for any help!
-D
basically is is a button which is created progammatically such as:
public abstract class BaseFrontEndEditor : System.Web.UI.UserControl
{
protected Button btnEdit = new Button();
private void Page_Load(object sender, System.EventArgs e)
{
if( ! this.IsPostBack )
{
btnEdit.Text="Edit";
btnEdit.ID = "btnEdit";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
}
}
The button is then added to the class's control collection.
I created another usercontrol that inherrits from this class, and placed it
on a page. This works, and when I view the aspx page the control is on, I
see the button. However, clicking the button never fires the event handler
("btnEdit_Click"). I have tried adding the event handler in the controls
"initializeComponent", as well as immediately after it is added (as seen
above). I have placed a simple Response.Write("hello") in the btnEdit_Click
function and nothing happens when the button is clicked. In fact, even the
button disappears. What's happening?
Thanks for any help!
-D