3

I'm looking for a sample using Autocomplete with DataTable. The autocomplete should have a table structure apart from single column.

Any hint..? Thanks! in advance

The mark up is as follows

 <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>
Rinshad Hameed
  • 117
  • 1
  • 6
  • 18
  • What do you mean by **with DataTable**? `Autocomplete` fed from `DataTable` or `Autocomplete` suggestion list displaying multiple columns? – TheVillageIdiot May 27 '13 at 05:14
  • @TheVillageIdiot i mean autocomplete suggestion list displaying multiple columns from a sql database as datatable. .plz help me. – Rinshad Hameed May 27 '13 at 05:18
  • 2
    Look at this answer: http://stackoverflow.com/a/12537306/360171 I believe you can utilize approach with `OnClientItemDataBinding` proposed in that answer, clear out content of autocomplete element generated by extender and re-create it on your own from `dataItem` object. Otherwise you need additional customization of AutoCompleteExtender's source code – Yuriy Rozhovetskiy May 27 '13 at 08:38
  • @YuriyRozhovetskiy The link you suggested is unable to digest for me. As i am new to asp.net can you please suggest any other method for this question? – Rinshad Hameed May 27 '13 at 09:26

1 Answers1

0

You can create your query accordingly
Example

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

Or you want combined result of two columns to display then you can use union like below

 select 
       [columnName]
 from
       [tableName]
 where
       [columnName] like %[input value]% 
 union
      select 
       [columnName1]
 from
       [tableName]
 where
       [columnName1] like %[input value]%  
शेखर
  • 17,412
  • 13
  • 61
  • 117