Setting certain columns to use dropdowns in edit mode RRS feed

  • Question

  • User-1682676269 posted

    Hi there,

    When you edit a row in a table the detailsview will sometimes show some dropdown boxes instead of allowing users to type whatever. I read that this is because these are Foreign Key columns?

     My question is - Is there a way to add a dropdown to any column?

     I have a view which is made up of a few tables and I want some of the columns to use dropdowns when editing.

     Appreciate any feedback.


    Tuesday, December 16, 2008 11:05 PM


All replies

  • User-330204900 posted

    Hi Mdesoysa, have a look at these article here:

    1. Your First FieldTemplate.
    2. An Advanced FieldTemplate.
    3. A Second Advanced FieldTemplate.
    4. An Advanced FieldTemplate with a GridView.
    5. An Advanced FieldTemplate with a DetailsView.
    6. An Advanced FieldTemplate with a GridView/DetailsView Project

    The article that does what you want if in part 3 but you may fine the rest interesting. [:D]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 17, 2008 6:31 AM
  • User660823006 posted

    We are adding new support in the next version of Dynamic Data where if you map an enumeration to a column when displayed it would show the text from the enumeration. When edited it would show the drop down list of values from the enumeration. You can check out our latest preview here: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=20628. Check out the new enumeration attribute in the System.ComponentModel.DataAnnotations.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 17, 2008 11:00 AM
  • User-1682676269 posted

     Steve - I had a look at your article an I'm still a little bit unsure on how to add this dropdown box in there...

     Scott - do I need to overwrite the old reference with this one? I was thinking of waiting till the full release...



    Wednesday, December 17, 2008 8:15 PM
  • User-1682676269 posted

     Steve I was looking at your other post "An advanced Field Template" (the one before) and it uses a dropdown but I think for this example you create the values that appear in the dropdwon via the enum right?

     I just want to something like that but where the data in the dropdown comes from a table.

     If I copy the enumeration control from the future site can I use that? or...

     I'm a bit confused with the whole thing sorry to be a pain !


    Wednesday, December 17, 2008 8:53 PM
  • User-1682676269 posted

     I just tried using the method from steves 2nd post like I mentioned earlier and I managed to get what I wanted except to populate the dropdown I bound it to a datasource and set it to show 'markets' . Now my concern is, will I have to create a seperate control for each column other than markets to show this behaviour, with the datasource pointing to a different table each time? Beacuse using the same control for a different column results in the incorrect data shown.


    Wednesday, December 17, 2008 10:52 PM