[How Do I:] Add Controls to an ASP.NET Web Page Programmatically

Please install Silverlight or click download to watch video locally.

In this video Chris Pels will show how to create an ASP.NET server control programmatically at runtime and add it to a page. First, learn the basic concept of adding a control to a page programmatically. Then, the concept of a "container" control is examined which is necessary for adding a new control programmatically at runtime. Next, learn considerations for nesting programmatically added controls, and how creating separate methods can compartmentalize the process to make it more maintainable. In addition, learn considerations for managing view state when adding controls dynamically.

Presented by Chris Pels

Duration: 33 minutes, 56 seconds

Date: 24 July 2008

Watch    Video   |   Download    Video   |   VB Code    C# Code

Video downloads: WMV  |  Zune  |  iPod  |  PSP  |  MPEG-4  |  3GP

Audio downloads: AAC  |  WMA  |  MPEG-4  |  MPEG-3  |  MPEG-2

Comments : 8

Leave a Comment

mcgmatt : On July 29, 2008 12:02 AM said:

The part about Page_Init is very important, and should have been covered first, followed by the rest of the video with all your work being done inside Page_Init.  If anyone stops watching this video before the 30-minute mark, they'll think they should add controls in Page_Load, then they'll be confused when their controls disappear on postback.

atarikg : On October 04, 2008 2:05 AM said:

thanks, this is one of the videos I wanna watch...

hlaiasp : On November 13, 2008 10:07 PM said:

I am using VC2005 and ASP.NET 2.0. I noticed you are using 3.5.

I don't get intellisense for "mainContent" and "newsItems". Is it possible to make it work in 2.0?

djibril_chimere_DIAW : On November 30, 2008 2:16 PM said:

Thanks! Jërëjëf !

hamiltonbase : On February 07, 2009 11:49 AM said:

Question, I noticed on the placeholder.aspx page, you used

Dim label as Label = New Label()

as opposed to

Dim Label as New Label()

What's the difference between the two?

bohunt : On February 13, 2009 5:37 PM said:

Thanks for the video!

Inferano : On May 04, 2009 12:51 PM said:

Good tutorial :) It would be great if you had added a small demo to save data inserted in the dynamics controls to some database.

greatbear : On September 18, 2009 3:45 PM said:

agree with mcgmatt

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Microsoft Communities