您好我有一个填充了CUSTOMERS的组合框,然后是一个带有gridview的更新面板,也填充了CUSTOMERS(与组合框相同)。用户从组合框中选择一个客户,然后更新gridview,组合框始终拥有所有客户。我遇到的问题是更新面板只是在用户第一次选择客户时触发了选定的组合框,因此如果他们想要更改客户,则不会发生任何事情。调试它根本不会触发。如果我将组合框放在updatepanel中,它确实有效,但速度很慢。 对于具有相同搜索/下拉/自动完成功能的组合框有什么替代方法吗?
如果您想看到它,这是我当前的代码
<asp:ComboBox ID="cbCustomer" runat="server" AutoCompleteMode="SuggestAppend"
AutoPostBack="True" DataSourceID="dataSourceCBCust" DataTextField="CUST_NAME"
DataValueField="CUST_NO" MaxLength="0" style="display: inline;">
</asp:ComboBox>
<asp:UpdatePanel ID="upCustomer" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cbCustomer" EventName ="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="gvSiteAddress" EventName ="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<br />
<asp:GridView ID="gvCustomer" runat="server" AllowPaging="True" DataSourceID="dataSourceGVCust"
AutoGenerateColumns="True" DataKeyNames="CUST_NO" Visible="False">
<Columns>
<asp:CommandField ShowSelectButton="True" />
</Columns>
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
后端
Protected Sub cbCustomer_SelectedIndexChanged(sender As Object, e As EventArgs) _
Handles cbCustomer.SelectedIndexChanged
dataSourceGVCust.SelectCommand = _
ConfigurationManager.AppSettings("SelectCustomer") _
& " WHERE CUST_NO LIKE '%" _
& cbCustomer.Text.TrimEnd _
& "%' ORDER BY CUST_NAME"
gvCustomer.Visible = True
End Sub