Link to home
Avatar of Stefan Motz
Stefan MotzFlag for United States of America

asked on

ASP.NET MVC dropdown list - OrderBy

Hi Experts,
This code shows a dropdown list on my webpage, but it orders it by ID, not by Code, as I would like it to do it.

@Html.DropDownList("DelayCodesDDL", null, new { style = "background-color:#ffecb0; width:60px;" })

How could I make it order it by Code ascending? The table from where the dropdown list is populated hast two columns: ID, and Code.

Thank you for your help.
ASKER CERTIFIED SOLUTION
Avatar of Anil Golamari
Anil Golamari
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Stefan Motz

ASKER

The link was very useful; I managed to fix the problem.
Thank you very much!