Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Adding Controls to a Web Forms Page Programmatically

Reply
Thread Tools

Adding Controls to a Web Forms Page Programmatically

 
 
mark.norgate@gmail.com
Guest
Posts: n/a
 
      03-17-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Controls Programmatically Chakravarti Mukesh ASP .Net 3 02-14-2013 08:39 AM
Adding image buttons to web page programmatically Leon ASP .Net 3 02-12-2010 03:12 PM
Programmatically Adding Web User Controls Jason Dunbar ASP .Net Web Controls 0 11-08-2004 12:23 PM
Adding controls programmatically. Tim Marsden ASP .Net 2 05-25-2004 03:33 AM
Adding validation controls programmatically =?Utf-8?B?RCBTaGVsZG9u?= ASP .Net 2 05-11-2004 07:16 PM



Advertisments