自动扩展器Ajax控制工具包 [英] Auto Extender Ajax Control Toolkit

查看:66
本文介绍了自动扩展器Ajax控制工具包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个附加到TextBox控件的Ajax自动完成扩展器.当用户开始键入时,建议选项将显示在下方的分隔中.从网络服务电话获取建议.在OnClientItemSelected ="GetCode"上,我正在使用下面的JavaScript将选定的建议文本输入搜索框.
现在,我要按ENTER键以激活搜索.
如果用户从所获得的建议中进行选择,然后单击Enter.它工作正常.它激活搜索.这是我正在使用的代码.

Hi

I have a Ajax auto complete extender attached to TextBox control. When the user starts typing the suggestive options are displayed in the divsion underneath. Getting the suggestion from a webservice call. On OnClientItemSelected="GetCode" I am using the below JavaScript to get the selected suggestion text into the search box.
Now I want the ENTER click to activate the search.
If the user selects from the suggestions he is getting and clicks the enter. It works fine. It activates the search. This is the code I am using.

function GetCode(source, eventArgs) {
    var txtValue = document.getElementById(''<%=txtAutoComplete.ClientID%>'');
    txtValue.value = eventArgs._value;
    //$(''#<%= txtAutoComplete.ClientID %>'').val(eventArgs._value);
    $(''#<%= ImageButton1.ClientID %>'').click();
}


但是问题是,如果用户没有从建议中选择并输入一些文本并单击回车键,则不会激活搜索.是的,我知道它不会调用GetCode函数.
我没有怎么做.有人请帮助我.
我想要与www.laterooms.co.uk中完全一样的内容

谢谢


But The problem is if the user doesnt select from the suggestion and types some text and clicks the enter key Doesnot activate search. Yes I know that It doesnot call the GetCode Function.
I am not getting how to do this. Anyone Please help me..
I am want something exactly like in www.laterooms.co.uk

Thanks

推荐答案

(``#<%= txtAutoComplete.ClientID%>'')).val(eventArgs._value);
(''#<%= txtAutoComplete.ClientID %>'').val(eventArgs._value);


(''#<%= ImageButton1.ClientID%>'').click(); }
(''#<%= ImageButton1.ClientID %>'').click(); }


但是问题是,如果用户没有从建议中选择并输入一些文本并单击回车键,则不会激活搜索.是的,我知道它不会调用GetCode函数.
我没有怎么做.有人请帮助我.
我想要与www.laterooms.co.uk中完全一样的内容

谢谢


But The problem is if the user doesnt select from the suggestion and types some text and clicks the enter key Doesnot activate search. Yes I know that It doesnot call the GetCode Function.
I am not getting how to do this. Anyone Please help me..
I am want something exactly like in www.laterooms.co.uk

Thanks


将文本框放入< form>以动作作为搜索(或者,如果您正在做巧妙的AJAX技巧,则以动作作为启动搜索的javascript函数).当在表单中的任何文本输入控件中按下Enter键时,它们会自动提交HTML表单.

您也可以使其与客户端onKeyPress一起使用.但是将其放在< form>具有语义意义,并​​且更容易使用(如果您的用户关闭了JS,它会更好地降级),因此,除非有某些原因您不能这样做,否则我绝对会这样做.
Put the text box in a <form> with the action as the search (or, if you''re doing clever AJAX tricks, with the action as a javascript function that starts the search). Enter automatically submits HTML forms when pressed in any text input control within the form.

You could also make it work with a client-side onKeyPress. But putting it in a <form> makes semantic sense and is easier (and degrades better if your user has JS turned off), so I''d definitely do that unless there is some reason you can''t.


这篇关于自动扩展器Ajax控制工具包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆