aspx_professional thread: RE: Help with retreiving values from dynamica- lly added controls
Hey there,
I was wondering if anyone had found a nice solution to this?
If not then I have come up with some thing that solve this to a certain extent.
As I could not find the values within the controls on the postback within the event handler functions,
I had to find another way to retrieve the values.
I managed to do this by using the Page_PreRender event. Within this event I could access the values within
the controls.
If anyone wants to know anything more about it, let me know.
Aiden
-----Original Message-----
From: Montgomery, Aiden
Sent: 02 November 2001 10:47
To: ASPX_Professional
Subject: [aspx_professional] Help with retreiving values from
dynamically added controls
Sorry if this has been covered before but it is frustrating me.
I am going to take a moment to set the scene.
I have a page that has a textbox and a button on it.
You enter a value in the textbox then click the button.
The page reloads with the textbox and the button.
Also now the page has generated a number of placeholders and entered tables into each one. Also another set of textboxes appear.
The number of placeholders, and therefore tables, and extra text is determined by the number you entered into the textbox.
The extra text boxes are for you to enter the number of cells you require in each of the sections.
This is as far as I can get. I simply cannot find a way to get at the values which are typed into the generated textboxes and
therefore cannot determine how many cells are required in the sections.
What is it that I am over looking?
I have tried accessing the controls through using the findcontrol and the ID which I have sepcified. Also I have tried to access
them by using a foreach and going through the controls collection.
I have managed to get the actual controls. However not the values which they hold. Using the stated methods I found my way to the
actual control objects. Once there I cast them to (textbox) and then tried to access the textbox.value
This returned nothing.
I thought about the fact that because they were created dynamically they may have to be added to the page again after post back to
be able to access them. This helped in no way at all. I also enabled viewstate and again nothing.
Someone out there must know where I am going wrong.
Aiden
---
VBug Winter Conference 2001
Make no mistake - there's a great learning curve
for developers moving from COM to .NET. So why
would you want to be a pioneer and cross the bridges
first? Attend the .NET Developer's Conference
(28th to 30th November 2001) In London and realise
the benefits of adopting the technology early. By
attending you'll understand the key challenges and
be left with a thorough understanding of the major
.NET fundamentals. If you're already working
with .NET this is a must-attend event.
http://www.vbug.co.uk/redirect.asp?url=39&id=17
---
You are currently subscribed to
aspx_professional as: aiden.montgomery@f...
$subst('Email.Unsub')