adding button to custom control, and its even'ts do not fire every time.

S

sonic

hello,
I have this custom datagrid control, that inherits from DataGrid.
In addition to datagrid, I am adding a "status" table under it, and
another html button, which will trigger a new row.

My problem is that the events associated with the custom button do not
trigger every time.

I am adding my button as private global control inside of override
CreateChildControls(), and than calling _myButton.Render( writer )
inside of override Render( ... ) event.

Here is my code for the button:

_addnewbutton = new Button();
_addnewbutton.Text = "Add New";
_addnewbutton.CssClass = _customGridInputButton;
_addnewbutton.CausesValidation = this.CausesValidation;
_addnewbutton.Click += new EventHandler(_addnewbutton_Click);

note the CausesValidation, and _addnewbutton_Click are not
honored/triggered on first postback, but are working on each
consecutive postback after that :(

I am calling EnsureChildcontrols() inside of override Controls get; and
also tried ensuring it OnLoad event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top