当前位置: 首页 > 图文教程 > 网络编程 > Javascript > js AspxButton的客户端操作

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 js AspxButton的客户端操作


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 333 ::
收藏到网摘: n/a

processOnServer使您可以指定当前Button应该处理客户端的事件或服务器端事件。 javascript调用父窗口(父页面)的方法
window.parent与window.opener的区别 javascript调用主窗口方法
1: window.parent 是iframe页面调用父页面对象
2: window.opener 是window.open 打开的子页面调用父页面对象
具体例子就不写了。

DevExpress.Web控件中的AspxButton的客户端验证
我们在用.net 默认的AspButton做面页提交时,如果需要客户端验证,我们一般要
这么写就可以,如下:
<asp:Button ID="Button1" runat="server" Text="提交" OnClientClick="validate();" />
如果验证没能通过,在JS函数validate中直接return false就可以了,但AspxButton可不行,
费了好大的劲才找到合适的方法,如下:
<dxe:ASPxButton ID="btnApply" runat="server" OnClick="btnApply_Click" Text="添加" AutoPostBack="False">
<ClientSideEvents Click="validate" />
</dxe:ASPxButton>
首选,AspxButton的AutoPostBack属性设置为False,然后再添加一个客户端的Click事件,
这个事件就是执行客户端的一些验证,
function validate(s, e){
var select = document.getElementById("ddlSection");
if (select.value == "0") {
alert("请选择有效的值!");
e.processOnServer = false;
return false;
}
e.processOnServer = true;
}
在这个事件中,有一个非常重要的属性就是processOnServer,通过设置此属性的值(true/false),就可以让AspxButton是否执行其在服务器端的事件程序。
详细说明processOnServer:
true:处理在服务器端事件;
false:处理在客户端事件。
备注
processOnServer使您可以指定当前Button应该处理客户端的事件或服务器端事件。如果此属性设置为false则执行一个客户端事件的处理程序,事件完全是处理在客户端没有发到服务器。设置processOnServer属性设置为True,最终处理的事件在服务器端,即触发注册的服务器端事件。