tags:

views:

15

answers:

1

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.

A: 

You can use the ElementAt extension method (need using System.Linq)

var firstElement = selectList.Items.ElementAt(0);
uvita
thanks for the help,rod.
rod