Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. dynamic dropdown select list

dynamic dropdown select list

Scheduled Pinned Locked Moved C#
csharphtmlasp-netdatabasetutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hamza ain uddin khan
    wrote on last edited by
    #1

    I am newbie in asp.net Using EF , I am fetching movie type from db. Don't no how to display in dropdown as well as if movietype get edit using EF how it will show selected or saved dropdown selected value? code

    @Html.DropDownListFor( m => m.Parent, new[] { @Value = newViewBag.MovieType } }

    L D 2 Replies Last reply
    0
    • H Hamza ain uddin khan

      I am newbie in asp.net Using EF , I am fetching movie type from db. Don't no how to display in dropdown as well as if movietype get edit using EF how it will show selected or saved dropdown selected value? code

      @Html.DropDownListFor( m => m.Parent, new[] { @Value = newViewBag.MovieType } }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 10324020 wrote:

      asp.net

      You might have a better chance of getting a response if you posted your question in the ASP.NET forum.

      H 1 Reply Last reply
      0
      • L Lost User

        Member 10324020 wrote:

        asp.net

        You might have a better chance of getting a response if you posted your question in the ASP.NET forum.

        H Offline
        H Offline
        Hamza ain uddin khan
        wrote on last edited by
        #3

        Thanks for advice please let me know asp.net forum or any place here for help.thanks

        1 Reply Last reply
        0
        • H Hamza ain uddin khan

          I am newbie in asp.net Using EF , I am fetching movie type from db. Don't no how to display in dropdown as well as if movietype get edit using EF how it will show selected or saved dropdown selected value? code

          @Html.DropDownListFor( m => m.Parent, new[] { @Value = newViewBag.MovieType } }

          D Offline
          D Offline
          Deepanshu Goel
          wrote on last edited by
          #4

          Hi, Here is the code that can be used on cshtml pages @Html.DropDownListFor(model => model.movietypeID, new SelectList(Model.movietypes, "Key", "value"), "--Select--") You need to bind the movietypes variable as a dictionary from the database. On the time of editing, you need to fetch the value of movie type selected at the time of creation and assign it to movietypeID, and again you will have to bind the movietypes variable from the database.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups