homecontroller控制器中的index动作代码如下:
public actionresult index()
{
list<selectlistitem> list = new list<selectlistitem>()
{
new selectlistitem(){text="张三",value="001"},
new selectlistitem(){text="李四",value="002"},
new selectlistitem(){text="王五",value="003"},
new selectlistitem(){text="赵六",value="004"},
new selectlistitem(){text="田七",value="005",selected=true}
};
viewdata["namelist"] = list;
return view();
}