views:

244

answers:

4

Hi All,

I have created a keyboard using asp:button control. Onclientclick event it will display the corresponding text on the textbox. All these are working fine.

Needs:

  1. I want to add autocomplete using jquery to a textbox. if i click the button [A] it has to display all the records with a.

  2. This process is working if im using the system keyboard.

Code:

      <link href="CSS/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
      <script type="text/javascript" src="js/jquery.autocomplete.js"></script>  

      $("#antSearchText").autocomplete('SearchAutoComplete.ashx');

     <asp:Button ID="six" runat="server" Text="6" CssClass="myclass" OnClientClick="return typeLetter(this);" />

Geetha.

A: 

You should return false at the end of client click event and do the textbox manipulation in typeletter function. It should look like OnClientClick="typeLetter(this);return false;"

This stops the asp:button from posting back

Midhat
A: 

The problem is the plugin, by default uses the onKeyUp event (probably) which is why the system keybord would work. The API doese provide a call to trigger the search

http://docs.jquery.com/Plugins/Autocomplete/search

I didn't see any thing like $(this).search() or $('input#suggest').search(); in your function. I could have missed it though

You can probably now ignore the following!

OLD ANSWER BELOW

Try using a standard HTML button instead of an ASP:net button, if there is no other reason to use an ASP:net button control that is.

Jon P
+1  A: 

The documentation here explains how to activate autocomplete on a textbox: JQuery Autocomplete. Have you tried that, and it still doesn't work?

Otherwise, can you add more information? What makes the 'system keyboard' work? What does the typeletter function do?

Glen Little
A: 

Hi All,

Thank You for all your replies. My problem resolved by using the following code to fire the event.

Code:

   var q = document.getElementById('txtbox');
   var evObj = document.createEventObject();
   evObj.keyCode = 84; // [T] key
   q.fireEvent('onkeydown', evObj);

Geetha.

Geetha