How to Add/Remove controls dynamically in ASP.NET AJAX Update Panel

You have implemented AJAX asynchronous postback using ASP.NET AJAX Update Panel and you want to clear all controls in Update Panel after postback you can write following:


If you want to add controls in UpdatePanel you can write:

Label lblMessage = new Label(); 
lblMessage.Text = "Thank You";


Finally you can call Update method of UpdatePanel




About author

User avatar

Waqas Anwar

Founder of, Senior Consultant, Microsoft .NET and Web Technologies