Search code examples
drop-down-menuasp.net-3.5dynamic-data

ASP.NET Dynamic data Change text field to dropdown and populate with some data


I have an ASP.NET dynamic data site and for one of the text fields within Edit and Insert templates I'd like to covert it to dropdown and populate that drop down programmatically. Can you help or point into right direction ?

Thanks.


Solution

  • What you will need to do is create a Custom FieldTemplate and use the UIHint Attribute on the column/property to direct ASP.NET Dynamic Data to use that Custom FieldTemplate in Insert and Edit mode.

    see here: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.uihintattribute.aspx

    and here: http://www.asp.net/learn/3.5-SP1/