CreateChildControls AFTER Postback

Posted by Francois on Stack Overflow See other posts from Stack Overflow or by Francois
Published on 2010-03-12T13:49:48Z Indexed on 2010/04/03 5:23 UTC
Read the original article Hit count: 359

I'm creating my own CompositeControl: a collection of MyLineWebControl and a "add" button. When the user press the "add" button, a new MyLineWebControl is added.

In CreateChildControls(), I run through my model (some object MyGridOfLines which has a collection of MyLine) and add one MyLineWebControl for each MyLine.

In addButton.Click, I add a new MyLine to my object MyGridOfLines.

But, since the Click event method is called after CreateChildControls(), the new MyLineWebControl will be only displayed on the next postback.

What can I do to "redraw" immediately my control, without loosing values that I've entered in each input?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about webcontrol