473,545 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2925
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*@REpoMOweVE rpick.com> wrote in message
news:u5******** ******@TK2MSFTN GP14.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
6164
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 from the cli is for all intents practicaly instantaneous. After much research I discovered that PHP by default uses a dynamic cursor type which can...
3
2963
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 do i add the EventHandler to it. Thanks RSB
3
3956
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 step you're on. This all works fine, but I ran into some trouble when I started creating controls dynamically in my code-behind file. Each panel...
1
2559
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 adding that control as: Protected WithEvents userSelectionList, Ulist2 As System.Web.UI.WebControls.CheckBoxList Protected WithEvents...
1
1809
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 they want to see. The question I have is when retrieving the dynamic fields for my form, should I get everything in one grab (dynamic fields and data)...
4
304
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 runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)
0
2223
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 dynamic controls. Our application was having a problem very similar to the one described here: ...
4
4743
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 to demonstrate my issues. Lets say I have a WebForm with a DropDownList where the user selects a number from 1 to 10 (the DropDownList is not...
2
1383
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() End If Dim ds As New DataSet Dim name, unit ,namunt As String da.Fill(ds, "sys_params")
0
7664
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7437
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7771
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5982
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.