473,399 Members | 3,656 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,399 software developers and data experts.

Dynamic controls - Adding & Retrieving value

I'm a little confused about in what Event should I add dynamic controls and
in what Event should I retrieve the value of a dynamic control on postback.

I've found that adding dynamic controls in the Page Load event works, and I
realize that I need to add the dynamic controls again on each postback. But
if I'm trying to retrieve the value of a dynamic control (Text property of a
TextBox for instance), should I retrieve the value in the PreRender event?
This seems to work, but I don't know if that's when I'm supposed to retrieve
the value.

Tia,
Ben
Nov 19 '05 #1
2 2913
Ben,

After you re-create the controls, you can access their values in any event,
even in the same Page_Load. Pick the one that suits your application logic.

Eliyahu

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:u5**************@TK2MSFTNGP14.phx.gbl...
I'm a little confused about in what Event should I add dynamic controls and in what Event should I retrieve the value of a dynamic control on postback.
I've found that adding dynamic controls in the Page Load event works, and I realize that I need to add the dynamic controls again on each postback. But if I'm trying to retrieve the value of a dynamic control (Text property of a TextBox for instance), should I retrieve the value in the PreRender event?
This seems to work, but I don't know if that's when I'm supposed to retrieve the value.

Tia,
Ben

Nov 19 '05 #2
Eliyahu Goldin wrote:
Ben,

After you re-create the controls, you can access their values in any
event, even in the same Page_Load. Pick the one that suits your
application logic.

Eliyahu


Hi Eliyahu,

I'm not in front of the IDE right now ... however when I was testing this
earlier, I was recreating the dynamic controls in the Page_Load event during
a postback, however, after recreating the control, I would check the value
of the control while still in the Page_Load event, and it was empty (i.e. no
value).

If I wait until the PreRender event fires, then the value of the control is
populated.

I haven't tested yet whether the value of the control is populated or not
when a Button's Click event fires, for example (which I believe occurs
between the Page_Load and PreRender events). Hopefully I'll be able to
retrieve the value in the Click event as waiting for the PreRender event to
fire seems like "waiting to the last minute".

Thanks for your reply!
Ben
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select...
3
by: RSB | last post by:
Hi Every one Having tuff time creating web controls Dynamically. All i am trying to do is read a table and generate a list of ASP TEXT Box. So how do i create this Control dynamically and where...
3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
1
by: segue | last post by:
I'm dynamically creating/populating a checkbox list and adding it to a web form. I want to when checking an item in the list have the autopostback retrieve the selected item. I'm dynamically...
1
by: Mike Collins | last post by:
I have a web form that has most of the UI designed. On this form, some of the labels, textboxes, dropdowns, etc. will be added dynamically, depending on what extra bits of data the user decides...
4
by: rn5a | last post by:
Assume that a ASPX page uses a user control named Address.ascx which has 2 TextBoxes. This ASCX page creates 2 properties named 'Address' & 'City' using the Get & Set statements: <script...
0
by: Scott Roberts | last post by:
I always thought that the viewstate "keys" included the control ID. As long as the control IDs were unique, there shouldn't be any conflicts. Well, it appears that that may not be the case with...
4
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
2
by: bharathi228 | last post by:
my code for retrieving values from database Dim da As New SqlDataAdapter("select parameter_name,parameter_units from sys_params", con) If con.State = ConnectionState.Closed Then con.Open()...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.