Hello,因为标题声明我的OnSelectedIndexChanged事件仅在您选择项目时触发,然后按 Enter 。我的组合框和gridview从数据源中获取它们的值。 OnSelectedIndexChanged gridview过滤器,但组合框始终具有所有值。有没有想过为什么会这样?
ASP
<asp:combobox ID="cbCustomer" runat="server" AutoCompleteMode="SuggestAppend" AutoPostBack="True"
DataSourceID="dataSourceCBCust" DataTextField="CUST_NAME" DataValueField="CUST_NAME" MaxLength="0"
style="display: inline;" OnSelectedIndexChanged="cbCustomer_SelectedIndexChanged">
</asp:combobox>
<asp:UpdatePanel ID="upCustomer" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cbCustomer" EventName ="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="gvCustomer" runat="server" AllowPaging="True" DataSourceID="dataSourceGVCust"
AutoGenerateColumns="True" Visible="true" ShowHeaderWhenEmpty="True">
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
VB
Protected Sub cbCustomer_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbCustomer.SelectedIndexChanged
'do stuff
End Sub