To create controls and position them, what I usually do is (and these steps
I do in PAGE_LOAD):
1) Add a PlaceHolder control in the place on the page where I want the
server control to be.
2) Create the server control using Page.LoadControl.
3) Assign an id to the control. Make sure this id is unique within the
controls collection that this control will be added to.
4) Update the server control for display.
5) Add the created control(s) to the PlaceHolder.Controls collection.
And one hint:
- You have to do this process on a postback if you want to get data &
events out of the server control. So, on a postback, do steps 1, 2, 3, and
5; make sure you skip 4 otherwise you will overwrite any value getting
posted back. And, if you don't keep the id the same, you will not get any
data or events posted back.
Jeff
"Chris Davoli" <Ch*********@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...
How do I dynamically add web server controls to a web form? Also, how can
I
position them?
Any sample code or links would be appreciated...
--
Chris Davoli