Hi All,
I just populated my SelectList variable inside my controller. Is there a way to get the first value of the selectlist into another variable?
thanks, rod.
Hi All,
I just populated my SelectList variable inside my controller. Is there a way to get the first value of the selectlist into another variable?
thanks, rod.
You can use the ElementAt extension method (need using System.Linq)
var firstElement = selectList.Items.ElementAt(0);