Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Adding Controls to a Web Forms Page Programmatically (http://www.velocityreviews.com/forums/t758262-adding-controls-to-a-web-forms-page-programmatically.html)

mark.norgate@gmail.com 03-17-2006 04:33 PM

Adding Controls to a Web Forms Page Programmatically
 
Hi

I'm having some trouble adding a user control to my webform
programmatically. I've done this before, but not for some time.

The control was rather complex, but I created a new one consisting of
an <asp:Label> control just so I can see what's going on.

I'm creating and adding the user control in my Page_Load method on my
webform:

private void Page_Load(object sender, System.EventArgs e) {
ProjectDetailsControl projectDetails = new ProjectDetailsControl();

// add the project to the project placeholder
ProjectPlaceHolder.Controls.Add( projectDetails );

// ...and so on
}

The Page_Load method of the user control is being called, but it's not
rendering any HTML. I haven't made any modifications to anything else,
including modifying the user control in any way besides dropping a
label with some text onto it.

What am I missing? Or have I done something I shouldn't?

Help appreciated!

Thanks, Mark



All times are GMT. The time now is 05:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.