Last post May 24, 2005 12:25 PM by PLBlum
May 24, 2005 11:03 AM|Mark_Elford|LINK
Can anyone help,, I am new to ASP.net and I am trying to create a new custom web control that gets dynamically built at page load.
So far I can build the control and output to the screen. however it outputs to the bottom of the page.
My page is divided into DIV blocks with ID's
Ideally I would like my controls to be built to the pages Div id myThumbs
This is the code I have currently...
ArrayList allimages = gallery.GetAllImagesIn(sPath);
I presume I would need something like this.myThumbs.control.add(thumbnail);
Any help would be usefull
May 24, 2005 12:25 PM|Mark_Elford|LINK
May 24, 2005 12:40 PM|PLBlum|LINK
You are adding to 'this.control'. If this is a page, then 'this' the page object itself.
Now the Page object does not have a collection called 'control'. It (and all controls) have a collection called "Controls" (note the case of the C). So I'm not sure how this even compiles in C#.
When you add a control into the page, you really need to add it to another control that is correctly positioned. ASP.NET provides the PlaceHolder control for that. Just add a PlaceHolder where you want to add these items. Then use:
You can also add your control to any of the container controls: Panel, UserControl, TableCell, rows of DataGrids, etc.