469,573 Members | 1,702 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

creating webform controls at run time

hi,

is it possible to create controls in a webform at run time in the Page_Load
event.

i would like to create a calculated amount of labels as the page loads,
place them at certain places on the page, and place some data there, after
getting some info from a backend database.

is this possible? i would appreciate a bit of code.

thanks

ray
Nov 19 '05 #1
4 933
Code along these lines should do what you want:

Dim lbl as New Label.
lbl.Text="Whatever"
SomePanel.Controls.Add(lbl)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"ray well" <no****@nospam.com> wrote in message
news:ey**************@TK2MSFTNGP14.phx.gbl...
hi,

is it possible to create controls in a webform at run time in the
Page_Load
event.

i would like to create a calculated amount of labels as the page loads,
place them at certain places on the page, and place some data there,
after
getting some info from a backend database.

is this possible? i would appreciate a bit of code.

thanks

ray

Nov 19 '05 #2
thanks steve,

is there a way to move the control to a specific location on the panel or
page, i could not find any location property? how would i do it?

thanks

ray
Nov 19 '05 #3
Your best bet is to put the panel where you want in advance, then add the
control to it at design time.
You can also use placeholder controls.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"ray well" <no****@nospam.com> wrote in message
news:ev*************@tk2msftngp13.phx.gbl...
thanks steve,

is there a way to move the control to a specific location on the panel or
page, i could not find any location property? how would i do it?

thanks

ray

Nov 19 '05 #4
WJ
Very clumsy but it can be done. Example: At design time, build a nested
table, hide it (Visible=false). At run time, assign the newly created WC to
a specific pre-designed cell of a selected Table, make sure set Visible to
True.

John

"ray well" <no****@nospam.com> wrote in message
news:ev*************@tk2msftngp13.phx.gbl...
thanks steve,

is there a way to move the control to a specific location on the panel or
page, i could not find any location property? how would i do it?

thanks

ray

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Phillip N Rounds | last post: by
9 posts views Thread by Peter Afonin | last post: by
2 posts views Thread by jlopes151 | last post: by
3 posts views Thread by Arne | last post: by
5 posts views Thread by SalamElias | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.