Dynamic DataList ItemTemplate based on data

H

Harry Simpson

Basically have a datalist now with an itemtemplate containing a textbox for
user entry and a label. The datalist is bound to a database table.

My boss wants the database table to have possible answers to some of the
items. Then if their are possible answers given, replace the TextBox with a
populated dropdown box with those possible answers as list items in the
dropdown.

This cannot be done can it? I know I can do something similar to this using
placeholders etc.....but can it be done using the datalist controls?

TIA mucho!

Harry
 
G

Guest

Yes this can be done. I believe a datagrid would better suit your job
however. You would have to attach Item Data Bound event. In the Item
Template you could add both the Text Box and the Drop Down List and hide one
or the other according to the value in the dataset.

HTH
 
H

Harry Simpson

Reckon that would work but then how would i know to take data from the
textbox vs. the dropdown when saving data entered back to the database?

Course it's friday and mind brain is pretty dead by Friday....

TIA
Harry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top