我有一个下拉列表,我在 aspx 标记上声明如下:
<asp:DropDownList ID="State" runat="server"></asp:DropDownList>
然后我像这样在页面加载时绑定它:
protected void Page_Load(object sender, EventArgs e)
{
BindDropdowns();
}
private void BindDropdowns()
{
State.DataSource = DataAccess.GetStates();
State.DataValueField = "FieldId";
State.DataTextField = "FieldName";
State.DataBind();
}
回发后不保留所选值,我也无法触发 selectedindexchangedevent。怎么了 ?