473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 979
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Phillip N Rounds | last post by:
I have a webform, from which I have to submit info to another site. Their instructions are to have a html form, with the following as the submit: <form method="post"...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
9
by: Peter Afonin | last post by:
Hello: I need to clear all textboxes on the webform after the data has been submitted. How can I do this in one step? I found a C# code: // get a reference to your form control Control frm...
2
by: Anand Sagar | last post by:
I have a Panel1 and button1 on my webform. At runtime, I create 2 textboxes. I do it at the Page_Load event. I put the code within the " If Not isPostBack" For the button click event, I will do...
2
by: jlopes151 | last post by:
Question: I'm creating an ASP.NET webform and I have questions about how the ASP.NET form works. In ASP or HTML a form with an action will transfer that forms items to another page. From the...
2
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is...
3
by: Arne | last post by:
I know that I can create web controls on the fly and add them to a placeholder. The problem with that is that I don't get any view state that way. I have a series webform templates defined in a...
1
by: bill | last post by:
I'm using VS2005. I am dynamically adding a Textbox control to a Placeholder control in the page_load event of the form, but the event handler isn't firing. What am I doing wrong? Thanks...
5
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.