Dynamic DataList ItemTemplate based on data

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
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
 
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
 
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
 
Back
Top