Declaring an unknown number of DropDownLists as having certain styles

JataddebyAber

New Member
To lay some background, I have a section of an intranet site where users add skills to a profile, but with the nature of skills, there are new ones always added, so I can never know exactly how many skills I will have.I have a custom styling that I apply to my \[code\]Html.DropDownLists\[/code\] :\[code\]<script> $(function () { $(".response").combobox(); }); </script>\[/code\]This normally works fine, but due to the nature of the data I'm trying to capture, I have to name my DropDownLists with an incremental array. It works something like this when drawing up the HTML:\[code\]//Declare int answerIndex as 0//foreach answer in questions [email protected]("answers[" + answerIndex + "].Response", new SelectList(ViewBag.Responses, "Id", "Name"), "")//answerIndex++;//end foreach\[/code\]My UpdateSkills method on my controller class takes in the variable:SQEPAnswer[] answersWhich deems the above necessary - it takes in all the details of the answer.However, the simple styling option referenced at first - I can't figure out a way to apply it reliably, I guess I could declare an array of style options in my js but that makes my spine crawl...If anyone knows how I can apply my styling to my DropDownLists, I would be very appreciative - I'm a competent enough programmer but this area of programming is not my strongest point.I am using Razor markup on MVC #4, any questions/comments are welcome to help me get to where I want.
 
Back
Top