First post! First post!!
Background: I'm a C programmer trying to learn C# ASP.NET MVC on my shiny new Visual Studio 2015 Community Edition. tl;dr everything I say will be wrong.
So, I have my view, and I would like to randomly show one of two 'select something' questions:
<p>I like to eat
@Html.DropDownList("answers[0]" + Model[0].ToSelectList(), "")
.
</p>
or
<p>My hair is
@Html.DropDownList("answers[1]" + Model[1].ToSelectList(), "")
.
</p>
But it turns out I can't figure out EITHER of the requirements (1. generate a 50/50 random number, 2. us it in an if to write HTML). Could anyone give me a shove in the right direction?
Also, I seem to be able to use this 'answers' structure without ever making it. If I end up with an 'answers' that only has data in say indexes 2, 9 and 33, does a 34 element array get passed back (Posted?)
Aucun commentaire:
Enregistrer un commentaire