如题前台用EXTJS 做了个登录框,
后台用什么事件触发事件来获取前台的输入数据 后验证用户名和密码正确了后返回
部分代码
login.aspx
<head runat="server">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="JS/login.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="yes">
</div>
</form>
</body>
login.js文件这样
Ext.onReady(function(){
Ext.QuickTips.init();//初始化全局 QuickTips 实例.设置当出错时提示信息
Ext.form.Field.prototype.msgTarget = 'side';//初始化提示标志.设置当出错时提示标志的感叹号图标
var login = new Ext.FormPanel({ //Panel:面板
title:"登 陆",
frame:true, //属性frame:把四个角变成圆角
width:260,
height:130,
layout:"form",
labelWidth:45,
defaults:{xtype:"textfield",width:180},
items:[{ //items:指定包含在面板中的组件的配置数组
fieldLabel:"账 号",
name:"uName",
allowBlank:false
},{
fieldLabel:"密 码",
name:"uPsw",
inputType:"password",
allowBlank:false
}],
buttons:[{
text:'Login',
formBind: true,
// Function that fires when user clicks the button
handler:function(){
login.getForm().submit({
method:'POST',
url:'login.aspx',
waitTitle:'Connecting',
waitMsg:'Sending data...',
// Functions that fire (success or failure) when the server responds.
// The one that executes is determined by the
// response that comes from login.asp as seen below. The server would
// actually respond with valid JSON,
// something like: response.write "{ success: true}" or
// response.write "{ success: false, errors: { reason: 'Login failed. Try again.' }}"
// depending on the logic contained within your server script.
// If a success occurs, the user is notified with an alert messagebox,
// and when they click "OK", they are redirected to whatever page
// you define as redirect.
success:function(){
Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
if (btn == 'ok'){
var redirect = 'index.aspx';
window.location = redirect;
}
});
},
// Failure function, see comment above re: success and failure.
// 如果登录失败,弹出对话框。
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Login Failed!', obj.errors.reason);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
login.getForm().reset();
}
});
}
},
{
text:'Cancel',
formBind:true,
handler:function(){login.getForm().reset();}
}]
});
var win = new Ext.Window({
layout:'fit',
width:300,
height:150,
closable: false,
resizable: false,
plain: true,
items: [login]
});
win.show();
});
后台login.aspx.cs 该怎么写啊 关键是 用什么事件触发
如果用page_load 事件和request方法来获取输入的用户名和密码
在页面加载时 还没输入数据啊 怎么得到数据啊
后台用什么事件触发事件来获取前台的输入数据 后验证用户名和密码正确了后返回
部分代码
login.aspx
<head runat="server">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="JS/login.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="yes">
</div>
</form>
</body>
login.js文件这样
Ext.onReady(function(){
Ext.QuickTips.init();//初始化全局 QuickTips 实例.设置当出错时提示信息
Ext.form.Field.prototype.msgTarget = 'side';//初始化提示标志.设置当出错时提示标志的感叹号图标
var login = new Ext.FormPanel({ //Panel:面板
title:"登 陆",
frame:true, //属性frame:把四个角变成圆角
width:260,
height:130,
layout:"form",
labelWidth:45,
defaults:{xtype:"textfield",width:180},
items:[{ //items:指定包含在面板中的组件的配置数组
fieldLabel:"账 号",
name:"uName",
allowBlank:false
},{
fieldLabel:"密 码",
name:"uPsw",
inputType:"password",
allowBlank:false
}],
buttons:[{
text:'Login',
formBind: true,
// Function that fires when user clicks the button
handler:function(){
login.getForm().submit({
method:'POST',
url:'login.aspx',
waitTitle:'Connecting',
waitMsg:'Sending data...',
// Functions that fire (success or failure) when the server responds.
// The one that executes is determined by the
// response that comes from login.asp as seen below. The server would
// actually respond with valid JSON,
// something like: response.write "{ success: true}" or
// response.write "{ success: false, errors: { reason: 'Login failed. Try again.' }}"
// depending on the logic contained within your server script.
// If a success occurs, the user is notified with an alert messagebox,
// and when they click "OK", they are redirected to whatever page
// you define as redirect.
success:function(){
Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
if (btn == 'ok'){
var redirect = 'index.aspx';
window.location = redirect;
}
});
},
// Failure function, see comment above re: success and failure.
// 如果登录失败,弹出对话框。
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Login Failed!', obj.errors.reason);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
login.getForm().reset();
}
});
}
},
{
text:'Cancel',
formBind:true,
handler:function(){login.getForm().reset();}
}]
});
var win = new Ext.Window({
layout:'fit',
width:300,
height:150,
closable: false,
resizable: false,
plain: true,
items: [login]
});
win.show();
});
后台login.aspx.cs 该怎么写啊 关键是 用什么事件触发
如果用page_load 事件和request方法来获取输入的用户名和密码
在页面加载时 还没输入数据啊 怎么得到数据啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货