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.
我用asp:button控件创建了一个键盘。 Onclientclick事件它将在文本框中显示相应的文本。所有这些都很好。
Needs:
-
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.
我想使用jquery将autocomplete添加到文本框中。如果我单击按钮[A],它必须显示所有记录。
-
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.
4 个解决方案
#1
1
The documentation here explains how to activate autocomplete on a textbox: JQuery Autocomplete. Have you tried that, and it still doesn't work?
此处的文档说明了如何在文本框上激活自动完成:JQuery自动完成。你试过了吗,它仍然无效?
Otherwise, can you add more information? What makes the 'system keyboard' work? What does the typeletter
function do?
否则,您可以添加更多信息吗?是什么让'系统键盘'工作? typeletter函数有什么作用?
#2
1
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.
#3
0
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;"
您应该在客户端单击事件结束时返回false并在typeletter函数中执行文本框操作。它应该看起来像OnClientClick =“typeLetter(this); return false;”
This stops the asp:button from posting back
这会阻止asp:按钮发回
#4
0
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
问题是插件,默认情况下使用onKeyUp事件(可能),这就是系统键盘可以工作的原因。 API doese提供触发搜索的调用
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
我没有看到任何像$(this).search()或$('input#suggest')。search();在你的功能。我本可以错过它
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.
如果没有其他理由使用ASP:net按钮控件,请尝试使用标准HTML按钮而不是ASP:net按钮。
#1
1
The documentation here explains how to activate autocomplete on a textbox: JQuery Autocomplete. Have you tried that, and it still doesn't work?
此处的文档说明了如何在文本框上激活自动完成:JQuery自动完成。你试过了吗,它仍然无效?
Otherwise, can you add more information? What makes the 'system keyboard' work? What does the typeletter
function do?
否则,您可以添加更多信息吗?是什么让'系统键盘'工作? typeletter函数有什么作用?
#2
1
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.
#3
0
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;"
您应该在客户端单击事件结束时返回false并在typeletter函数中执行文本框操作。它应该看起来像OnClientClick =“typeLetter(this); return false;”
This stops the asp:button from posting back
这会阻止asp:按钮发回
#4
0
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
问题是插件,默认情况下使用onKeyUp事件(可能),这就是系统键盘可以工作的原因。 API doese提供触发搜索的调用
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
我没有看到任何像$(this).search()或$('input#suggest')。search();在你的功能。我本可以错过它
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.
如果没有其他理由使用ASP:net按钮控件,请尝试使用标准HTML按钮而不是ASP:net按钮。