我有几个简单的下拉列表。第一个由 html 中的 linqdatsource 绑定,autopostback 设置为 true。第一个的选择决定了第二个中的数据。当我首先选择一个项目时, selectedindexChanged 事件会触发;但是,所选值始终是列表中的第一项,然后列表重新绑定并恢复到其默认状态。我是否必须在代码隐藏中绑定它以防止这种情况?
<asp:DropDownList ID="dd_shirtcolor" runat="server" AppendDataBoundItems="true" AutoPostBack="True">
<asp:ListItem Text="Select Color" />
</asp:DropDownList>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="IPC.IPCDataDataContext" EntityTypeName=""
TableName="Shirts" Where="IsActive == @IsActive">
<WhereParameters>
<asp:Parameter DefaultValue="true" Name="IsActive" Type="Boolean" />
</WhereParameters>
</asp:LinqDataSource>