471,571 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,571 software developers and data experts.

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

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
0 1154

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Nicolas Mejia | last post: by
reply views Thread by Pedro | last post: by
22 posts views Thread by Drum2001 | last post: by
1 post views Thread by Avi G | last post: by
8 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.