开发者

get selectlist first value in my controller

I just po开发者_JS百科pulated 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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜