使用带有onKeyUp的TextBox从TextChange中的数据库获取值,使用Jquery自动完成的onBlur事件 [英] Taking Values From Database in TextChange with a TextBox having onKeyUp,onBlur events for autocomplete by Jquery

查看:64
本文介绍了使用带有onKeyUp的TextBox从TextChange中的数据库获取值,使用Jquery自动完成的onBlur事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  function  showCustomer(event){
document .getElementById(' MainContent_hCustomer')。value = ' ';
showPopup(' customer'' MainContent_txtMobile'' MainContent_hCustomer' document .getElementById(' MainContent_txtMobile')。value,' ',event.keyCode);
}

function showCustomerDtls(){

if document .getElementById(' MainContent_hCustomer ')。value!= ){
$ .ajax( {
url:' ../ ajax / ajaxrequest.aspx?ObjectType = custdtls& searchText =' + document .getElementById(' MainContent_hCustomer')。value,
data:' '
成功:< span class =code-keyword> function (msg){ // alert(surl1);
var res = msg.split( ~~);
document .getElementById(' MainContent_txtCustomerName').value = res [ 0 ];
document .getElementById(' MainContent_txtAddress').value = res [ 1 ];
document .getElementById(' MainContent_txtMobile').value = res [ 2 ];
document .getElementById(' MainContent_hCuLedgerId').value = res [ 3 ];
funcall();
document .getElementById(' MainContent_gSales_tBrand_0'< /跨度>)聚焦();
}
});
}
}





 <   asp:TextBox     ID   =  txtMobile   < span class =code-attribute> autocomplete   =  off    runat   =  server    onKeyUp   =  showCustomer(event);    

class = tAjax

onBlur = showCustomerDtls();

TabIndex = 101 MaxLength = 10 ontextchanged = txtMobile_TextChanged >
< 输入 type = hidden id = < span class =code-keyword> hCustomer runat = server / >
< 输入 类型 = 隐藏 id = hCuLedgerId runat = server / >







当我在编辑时使用回发时,无法在autocomplete中选择另一个客户。我想要服务器端和上面的代码都应该实现将新数据绑定到网格的目的。



我正在使用以下所有这些Libaries



< link href =   ../../ Styles / css / jquery- ui.css rel =   stylesheet type =   text / css /> 
< link href = http://ajax.googleapis.com/ajax/libs/jqueryui/ 1.8.1 / themes / base / jquery-ui.css rel = stylesheet type = text / css />
< script src = ../../ Scripts / js / jquery.min.js type = text / javascript>< / script>
< script src = ../../ Scripts / js / jquery-ui.min。 js type = text / javascript>< / script>
< script type = text / javascript src = ../../ Scripts / js / PopupAutoComplete.js>< / script>
< script src = ../../ Scripts / js / jquery-1.9.1。 js type = text / javascript>< / script>
<% - < script src = // code.jquery.com/ui/1.10 .4 / jquery-ui.js>< / script> - %>
< script src = ../../ Scripts / js / jquery-ui.js type = text / javascript>< / script>
< script type = text / javascript src = ../../ Scripts / js / popuplist.js>< / script>
< script src = ../../ Scripts / js / jquery-1.10.2。 min.js type = text / javascript>< / script>

解决方案

.ajax({
url:' < span class =code-string> ../ ajax / ajaxrequest.aspx?ObjectType = custdtls& searchText =' + document .getElementById(' MainContent_hCustomer')。value,
data:' '
成功: function (msg){ // alert(surl1);
var res = msg.split( ~~);
实况ment .getElementById(' MainContent_txtCustomerName')。value = res [ 0 ];
document .getElementById(' MainContent_txtAddress').value = res [ 1 ];
document .getElementById(' MainContent_txtMobile').value = res [ 2 ];
document .getElementById(' MainContent_hCuLedgerId').value = res [ 3 ];
funcall();
document .getElementById(' MainContent_gSales_tBrand_0'< /跨度>)聚焦();
}
});
}
}





 <   asp:TextBox     ID   =  txtMobile   < span class =code-attribute> autocomplete   =  off    runat   =  server    onKeyUp   =  showCustomer(event);    

class = tAjax

onBlur = showCustomerDtls();

TabIndex = 101 MaxLength = 10 ontextchanged = txtMobile_TextChanged >
< 输入 type = hidden id = < span class =code-keyword> hCustomer runat = server / >
< 输入 类型 = 隐藏 id = hCuLedgerId runat = server / >







当我在编辑时使用回发时,无法在autocomplete中选择另一个客户。我想要服务器端和上面的代码都应该实现将新数据绑定到网格的目的。



我正在使用以下所有这些Libaries



< link href =   ../../ Styles / css / jquery- ui.css rel =   stylesheet type =   text / css /> 
< link href = http://ajax.googleapis.com/ajax/libs/jqueryui/ 1.8.1 / themes / base / jquery-ui.css rel = stylesheet type = text / css />
< script src = ../../ Scripts / js / jquery.min.js type = text / javascript>< / script>
< script src = ../../ Scripts / js / jquery-ui.min。 js type = text / javascript>< / script>
< script type = text / javascript src = ../../ Scripts / js / PopupAutoComplete.js>< / script>
< script src = ../../ Scripts / js / jquery-1.9.1。 js type = text / javascript>< / script>
<% - < script src = // code.jquery.com/ui/1.10 .4 / jquery-ui.js>< / script> - %>
< script src = ../../ Scripts / js / jquery-ui.js type = text / javascript>< / script>
< script type = text / javascript src = ../../ Scripts / js / popuplist.js>< / script>
< script src = ../../ Scripts / js / jquery-1.10.2。 min.js type = text / javascript>< / script>


 function showCustomer(event) {
document.getElementById('MainContent_hCustomer').value = '';
showPopup('customer', 'MainContent_txtMobile', 'MainContent_hCustomer', document.getElementById('MainContent_txtMobile').value, '', event.keyCode); 
}
 
function showCustomerDtls() {
 
if (document.getElementById('MainContent_hCustomer').value != "") {
$.ajax({
url: '../ajax/ajaxrequest.aspx?ObjectType=custdtls&searchText=' + document.getElementById('MainContent_hCustomer').value,
data: '',
success: function (msg) {//alert(surl1);
var res = msg.split("~~");
document.getElementById('MainContent_txtCustomerName').value = res[0];
document.getElementById('MainContent_txtAddress').value = res[1];
document.getElementById('MainContent_txtMobile').value = res[2];
document.getElementById('MainContent_hCuLedgerId').value = res[3];
funcall();
document.getElementById('MainContent_gSales_tBrand_0').focus();
}
});
}
}



 <asp:TextBox ID="txtMobile" autocomplete="off" runat="server" onKeyUp="showCustomer(event);" 

class="tAjax" 

onBlur="showCustomerDtls();" 

TabIndex="101" MaxLength="10" ontextchanged="txtMobile_TextChanged">
<input type="hidden" id="hCustomer" runat="server" />
<input type="hidden" id="hCuLedgerId" runat="server" />




When I use postback on this at the time of edit cant select another customer in autocomplete.I want both serverside and above code should to achieve the purpose of getting new data binding to the grid.

I am using all of this Libaries below

 <link href="../../Styles/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/js/jquery.min.js" type="text/javascript"></script>
<script src="../../Scripts/js/jquery-ui.min.js" type="text/javascript"></script> 
<script type="text/javascript" src="../../Scripts/js/PopupAutoComplete.js"></script> 
<script src="../../Scripts/js/jquery-1.9.1.js" type="text/javascript"></script>
<%--<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>--%>
<script src="../../Scripts/js/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/js/popuplist.js"></script>
<script src="../../Scripts/js/jquery-1.10.2.min.js" type="text/javascript"></script>

解决方案

.ajax({ url: '../ajax/ajaxrequest.aspx?ObjectType=custdtls&searchText=' + document.getElementById('MainContent_hCustomer').value, data: '', success: function (msg) {//alert(surl1); var res = msg.split("~~"); document.getElementById('MainContent_txtCustomerName').value = res[0]; document.getElementById('MainContent_txtAddress').value = res[1]; document.getElementById('MainContent_txtMobile').value = res[2]; document.getElementById('MainContent_hCuLedgerId').value = res[3]; funcall(); document.getElementById('MainContent_gSales_tBrand_0').focus(); } }); } }



 <asp:TextBox ID="txtMobile" autocomplete="off" runat="server" onKeyUp="showCustomer(event);" 

class="tAjax" 

onBlur="showCustomerDtls();" 

TabIndex="101" MaxLength="10" ontextchanged="txtMobile_TextChanged">
<input type="hidden" id="hCustomer" runat="server" />
<input type="hidden" id="hCuLedgerId" runat="server" />




When I use postback on this at the time of edit cant select another customer in autocomplete.I want both serverside and above code should to achieve the purpose of getting new data binding to the grid.

I am using all of this Libaries below

 <link href="../../Styles/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/js/jquery.min.js" type="text/javascript"></script>
<script src="../../Scripts/js/jquery-ui.min.js" type="text/javascript"></script> 
<script type="text/javascript" src="../../Scripts/js/PopupAutoComplete.js"></script> 
<script src="../../Scripts/js/jquery-1.9.1.js" type="text/javascript"></script>
<%--<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>--%>
<script src="../../Scripts/js/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/js/popuplist.js"></script>
<script src="../../Scripts/js/jquery-1.10.2.min.js" type="text/javascript"></script>


这篇关于使用带有onKeyUp的TextBox从TextChange中的数据库获取值,使用Jquery自动完成的onBlur事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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