Welcome

首页 / 脚本样式 / ExtJS / ExtJs2.0学习系列(8)--Ext.FormPanel之第五式(综合篇)

ExtJs2.0学习系列(8)--Ext.FormPanel之第五式(综合篇)2010-04-21 博客园 谦虚的天下在和前面的介绍中,我们基本上对form表单中常见组件有了简单的认识,今天我们做个综合点的例子,向服务器提交下!

其实这篇文章很简单,没有什么发光点,暂放首页半天,忘各位理解!

先来个简单的例子,以说明formpanel如何把数据传给其他页面。

效果图:

现在我们要实现的效果是:点击确定,把值传到另一页面!,如下:

原页面js代码为:

Ext.onReady(function(){
Ext.QuickTips.init();
var form=new Ext.FormPanel({
frame:true,
width:300,
//monitorValid:true,//绑定验证
layout:"form",
labelWidth:70,
title:"添加个人信息",
labelAlign:"left",
renderTo:Ext.getBody(),
submit: function(){
this.getEl().dom.action = "GetForm.aspx",
this.getEl().dom.method="POST",
this.getEl().dom.submit();
},
items:[{
xtype:"textfield",
fieldLabel:"用户名",
//id:"UserName",
allowBlank:false,
blankText:"不能为空,请正确填写",
name:"UserName",
anchor:"90%"
},{
xtype:"textfield",
fieldLabel:"昵称",
//id:"SmallName",
name:"SmallName",
anchor:"90%"
},{
xtype:"datefield",
fieldLabel:"注册日期",
//id:"RegDate",
name:"RegDate",
anchor:"90%"
}],
});
接受页面GetForm.aspx的cs代码为:

protected void Page_Load(object sender, EventArgs e)
{
string UserName = Request.Form["UserName"];
string SmallName = Request.Form["SmallName"];
string RegDate = Request.Form["RegDate"];
Response.Write(UserName + "<br/>" + SmallName + "<br/>" + RegDate);
}