Author: YairNevet | Posted on: 3/8/2010 5:20:06 PM | Views : 383

Hello folks,
The code below creating a button control on my page dynamicly.
I would like to add to the control's Click event a new event handler.
How should I do it?
please notice that i'm creating the control on Click-event of one of the pre-defined buttons( btnSubmit) on my the page and not at the Load event of the page:

protected void btnSubmit_Click(object sender, EventArgs e) { try { //create a new instance of the control Button new_button = new Button(); new_button.ID = txtID.Text; new_button.ForeColor = System.Drawing.Color.FromName(txtForeColor.Text); new_button.Text = txtText.Text; //add button to button array btn_arr[btn_count++] = new_button; //call our add function add_button(new_button); ...

Go to the complete details ...