By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.