3

我正在寻找使用带有 DataTable 的自动完成功能的示例。自动完成应该有一个除了单列之外的表结构。

任何提示..?谢谢!提前

标记如下

 <asp:TextBox ID="txtAutoCmplte" runat="server"></asp:TextBox>
  <asp:AutoCompleteExtender ID="txtAutoCmplte_AutoCompleteExtender" 
    runat="server" CompletionInterval="1" ServiceMethod="GetNames" 
    TargetControlID="txtAutoCmplte" 
        CompletionListCssClass="autocomplete_completionListElement" 
        MinimumPrefixLength="1" BehaviorID="AutoCompleteEx" 
        onclientpopulated="onListPopulated">
  </asp:AutoCompleteExtender>
  <asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>
4

1 回答 1

0

您可以相应地创建查询
示例

 select 
       [columnName]
 from
       [tableName]
 where
       [columnName1] like %[input value]%  or
       [columnName2] like %[input value]% 

或者您希望显示两列的组合结果,然后您可以使用union如下所示

 select 
       [columnName]
 from
       [tableName]
 where
       [columnName] like %[input value]% 
 union
      select 
       [columnName1]
 from
       [tableName]
 where
       [columnName1] like %[input value]%  
于 2013-05-27T05:48:16.963 回答