2016-09-19 59 views
0

我有一个sqldatasource的网络表格,填充DropDownList。网络表单的Page_LoadDropDownList中读取。SqlDataSource何时填充控件?

Page_Load执行时,看起来DropDownList中不存在该值; Page_Load期间DropDownList.Items.Count等于0。

所以,当下拉菜单填充?我知道我可以在代码隐藏中填充它,但我更喜欢使用sqldatasource

谢谢。

回答

0

MSDN link帮我解决了。

Page_LoadSqlDataSource控件尚未绑定。在访问控件之前,请致电DropDownList.DataBind()