Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

how to read values of dynamically created controls in a placeholder

Hello,

I am creating controls dynamically using a placeholder. I am successfull in creating the dynamic controls but failed to retrieve the values fro the controls. In detail...

1. One user say A is selecting IT as category and ASP.NET as subcategory...
2. When he go to the inner page, he has to answer some questions. Here all the questions will come from database. Whether to show it in listbox,checkbox,radiobutton etc also will be stored in database, so according to the QuestionType field in question type table , the questions will have choice of answers in listbox, radio button, textbox or check box.
3. The datas selected/entered by user will be stored in database with his userid.

When another user B comes, his category and subcategory may be different, so the questions also will be different. Anyway, whether each question answer has to show listbox, radibutton etc will be decided by the questiontype value corresponding to the QuestionTypeID.

So, in short, I am trying to create dynamic controls with place holder. I am successfull in creating controls. But I don't know, what to do, to retrieve the place holder values, like user has two questions

1. Languages Known
a. English
b. Malayalam
c. Tamil

2. Home Land
a. India
b. Pakistan
c. UAE
d. US

For queston ' 1 ' ,I am using listbox and user selects Malayalam and for question ' 2 ', I am using radio button and user selects US, so I have to store malayalam and us for the user(with the userid).

I am attaching the code,stored procedure,samplevalues in table etc in zip format. Please help me to find a solution.

Thanks
Ceema
[1776 byte] By [meera] at [2007-11-11 7:14:09]
# 1 Re: how to read values of dynamically created controls in a placeholder
if you have added controls as child controls into the placeholder you can use the FindControl method on the control to get hold of the collection of controls in the place holder, Then looping through each control and getting the control type and id you can get the value. This is generic ASP.Net I havent looked much at your code
srinivas_s at 2007-11-11 23:13:49 >
# 2 Re: how to read values of dynamically created controls in a placeholder
You may find some of these articles helpful:
http://www.google.com/search?q=asp.net+dynamic+controls
Phil Weber at 2007-11-11 23:14:54 >
# 3 Re: how to read values of dynamically created controls in a placeholder
Hello srinivas and Phil Weber,

Thank you so much for the reply, in all the google search sites they are telling how to create controls dynamically, but not telling how its values can be retrieved. I have got the answer from the site 'aboutfortunate.com'. Thanks a lot for the help.

Thanks again
Meera
meera at 2007-11-11 23:16:00 >