客户端控件触发不刷新页面
来源:互联网 发布:淘宝卖家首页怎么登陆 编辑:程序博客网 时间:2024/06/04 19:14
onBlur事件就是当光标离开文本框中时发生的事件。
当在文本框中离开时需要到数据库中取数据到其他框中,而不是以前用change事件去处理
1)
<asp:TextBox runat ="server" ID ="txtShipper" onblur="javascript:getShipper();" MaxLength="30" >
2)在.js文件中加入
function getShipper()
{
var _o=document.getElementById ("txtShipper");
PageMethods.CallBackShipper(_o.value,completeShipper,error);
}
function completeShipper(result)
{
valuesArr=result.split("//");
document.getElementById("txtShipper_name_in_Invoice").value=valuesArr[0];
document.getElementById("txtShipperFaxNo").value=valuesArr[1];
document.getElementById("txtShipper_Fax_Country_code").value=valuesArr[2];
}
{
var _o=document.getElementById ("txtShipper");
PageMethods.CallBackShipper(_o.value,completeShipper,error);
}
function completeShipper(result)
{
valuesArr=result.split("//");
document.getElementById("txtShipper_name_in_Invoice").value=valuesArr[0];
document.getElementById("txtShipperFaxNo").value=valuesArr[1];
document.getElementById("txtShipper_Fax_Country_code").value=valuesArr[2];
}
3)设置ScriptManager的EnablePageMethods="true"
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true"
EnableScriptLocalization="true" EnablePageMethods="true" >
EnableScriptLocalization="true" EnablePageMethods="true" >
4)在后台.cs代码中添加
[System.Web.Script.Services.ScriptMethod]
[System.Web.Services.WebMethod]
public static string CallBackShipper(string inputValue)
{
ChargeCommonBLL bll = new ChargeCommonBLL();
CustomInfo info = bll.GetCustomInfo(inputValue);
string returnValues = info.CustEName1 + "//" + info.FAX + "//" + info.Country;
return returnValues;
}
[System.Web.Services.WebMethod]
public static string CallBackShipper(string inputValue)
{
ChargeCommonBLL bll = new ChargeCommonBLL();
CustomInfo info = bll.GetCustomInfo(inputValue);
string returnValues = info.CustEName1 + "//" + info.FAX + "//" + info.Country;
return returnValues;
}
- 客户端控件触发不刷新页面
- 客户端调用不刷新页面(Anthem)
- dropdownlist 选择触发事件 不刷新整个页面
- asp.net中的按钮事件不触发页面验证控件
- 客户端密码控件(password)刷新页面保存值的解决方案
- GridView控件自带的不刷新页面的功能
- 不刷新页面---刷新数据
- 不刷新页面---刷新数据
- 页面不刷新
- 防止页面刷新造成二次事件触发
- asp.net中的按钮在页面上有验证控件的时候不触发按钮事件
- 如何在单击WEB控件引发页面刷新时定位页面?(不使用智能导航)
- ios8以前版本UIViewcontroller不兼容,刷新页面后部分控件不显示
- 不刷新页面,而刷新图片
- 页面不刷新,提交表单
- 页面不刷新,提交表单
- DIV 转换页面,不刷新
- 提交表单不刷新页面
- FAT结构
- 再论IBatisNet + Castle进行项目的开发
- castle project 发布新版本
- 使用Facility:EnterpriseLibrary整合进Castle
- 应用IBatisNet+Castle进行项目的开发
- 客户端控件触发不刷新页面
- SQL SERVER多列取最大或者最小值
- 开源的Ajax.Net类库
- 5种基本排序法
- Setting up Qt Development in Ubuntu 9.04
- IA-32结构c语言描述
- 发放gmail邀请,和大家共享gmail
- 截止09.6月的自我评价关键词
- 关于sql server的纪录修改冲突解决和oracle的for update 的并发锁定测试