Normally when you create a control dynamically means at runtime, on the next page load you will loose that control, that control will be no longer exists, in this example I am try to explain how we can store that controls and get them back.
Create a Web Application and Add one button to it.
In the page load add following code, in the following code I am creating a object of Control Collection and keeping it in the Session.
Now Doble click on button1 and add following code in Button1_Click event.
Here in this code I am storing all the controls created into control collection and saving into session.
now we are ready with code just build, run and test.
Tags: Creating Dynamic controls, ASP.NET, C#, Preserve the Dynamic controls
No comments:
Post a Comment