asp.net mvc 4 - How do I get the value of my drop down list -


I am trying to return the selected item and when I debug my code, the data data track list Is always empty.

How do I specify the value of the view data?

  Public Functioning Edit Percell (Ent ID) {Parcel Parcia = _abcSearchService.GetAbcParcel (id); & Lt; SelectListItem & gt; Tracklist = new list & lt; SelectListItem & gt; New selection list item {text = "processing", value = "processing", selected = true}, new selection list item {text = "out for delivery", value = "out for delivery"}, new selectistitem {text = "Deliver" value = "distributed"},}; ViewData ["TrackList"] = TrackList.Afake number (); }    

It all depends on how you are setting up the drop down. I will advise not to use view-back / data to send information, put it in its void and make a list of how you are making it, but save it in the viewing model

  viewModel.TrackList = TrackList;   

then

  @ html.DropDownListFor (x = & gt; x.Track, Model.TrackList)   

will override the selected property for the assistant. In this case you have to set the view model to set the selected value. Tracks for that price will be set accordingly for the track you want and the assistant. Tell me if you have any questions.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -