mvc bind enum to dropdownlist

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome to my channel this is Sharon in this video I will show you in Amethi how to burn enum values into a drop-down list and here we got the final output notice in the drop down list that leaner values of binder that's it if you are a first-time visitor to my channel please subscribe to get the latest updates for this video tutorial I'm creating a new MVC application go to file new project and from the web templates and selecting paste with dotnet web application and the dotnet framework am using 4.6.1 and the product name and we see is a project named click ok and then the tablets I'm selecting and missing okay and the project is created successfully let's close this window open solution Explorer now in this project I am adding a class in this models folder that look the models folder and selecting class a classroom I'm doing sports now in the sports class I'm adding the property public sports I really get and set after that I'm adding the enum public sports now in this enum I'm adding some values like Visa constrictor the supreme blessing poor and the last one I am adding boxing supposed to fight I have added five values to this ena huh after that open solution Explorer let's add a controller in this controllers folder right-click the controllers controller and surfing a missive a controller empty and the controller name is and here we got our controller sports are not adding and according to this controller just a ricotta view parish of the index so before creating the index view page let's build the application first build build solution and here we got a message the build succeeded let's close this output message box had the index right look that one add view the bunam is index on in the tablet empty without moral odd now i'm a training headed in the index view page not balanced after that I'm adding a centerline now before adding the data to the HTML helpers let's add underscore the project name God morals full dot dot that grass name is a sports class after that below the horizontal line and an impetus to dot I'm adding a special enum helper class you know drop-down list father the first parameter suppose ID which is a property I'm adding the default label of the drop-down list select sports that's it we have done the complete coding part now before on this application we must change the controller name open solution Explorer expand the app and erskyll start without conflict that says file open that one notice here the controller name is home just read that one and our control of navels are sports controllers copy the sports and the action result is a index view patiently which is this one that's it let's check the output Google Chrome and here we got the final output notice in the drop down list the enum value sub binder that's it
Info
Channel: Haritha Computers & Technology
Views: 5,469
Rating: undefined out of 5
Keywords: enum bind dropdownlist, enumdropdownlist, Create dropdown using Enum, enum types, enum, enums, asp.net mvc, Enumeration or Enum Types, mvc enum, c#, enum types in c#, Enum, data type, learning, programming, web development
Id: ZMqM5_pgpyE
Channel Id: undefined
Length: 5min 41sec (341 seconds)
Published: Mon May 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.