ASP.NET Random color selector algorithm
Posted on 2004-04-22
In ASP.NET, there is a Color enumeration.
I would like to be able to programmatically randomly select a color name during a postback event, and use it to build into a string to create a "template" in a textbox.
When posted back, a panel control is made visible and inside the panel is a textbox. The textbox will come pre-filled in with :
color is [color] where [color] is a randomly chosen color name from the Color enumeration.
I know one approach is the tedius way of making an array of all the cololr names and then using the random object to come up with a number. But what I am really look for from you experts is a more elegant and lazy approach.... THANKS..