.NET2.0问题:如何编程设置dropdownlist的默认显示值

来源:百度知道 编辑:UC知道 时间:2024/09/21 08:46:02
我知道可以在页面文件(.aspx)里通过Selected属性来设置默认显示值。
但不知道如何通过编程的方式来实现这一效果(在.aspx.cs文件中实现)。
大家帮帮忙啊!!!

//aspx.cs
写在page_Load方法中
this.dropdownlist.SelectedIndex = 0;

上面方法可行。。或者把某一项的selected设置为true也行

this.dropdownlist.SelectedIndex = ?;

this.dropdownlist.SelectedValue = ?;

以上方法鉴定都可行