汪立ID:lee576
164728次访问,排名427好友25人,关注者29
不要想给自己找个“老师”,自己就是自己的老师,勤奋与思考,才配做程序员!
lee576的文章
原创 515 篇
翻译 4 篇
转载 312 篇
评论 35 篇
lee576的公告
渴望知识的力量,知识创造财富和价值并赢得时间
最近评论
VincenT08:实验成功!Thanks!!!
huangjacky:不错,收藏
soulmelody:我也是刚接触的
前天用CSS外部样式表控制样式
结果我就从HTML前台代码下手,看了源代码才知道
不过没想到访问是这样的!!不错!!
pupstar:现在直接用工具!或windows pe
zhoubinlai:我按上面的例子做了,'Ext'未定义,是怎么回事。
文章分类
收藏
    相册
    跳伞
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 ExtJS与.NET结合开发实例(Grid之新增——Form提交篇)收藏

    新一篇: EXT调用ASP.NET AJAX WebService | 旧一篇: ExtJS与.NET结合开发实例(Grid之批量删除篇)

    我们新增记录功能的步骤如下:
        1.新建FORM
          FORM的建立是用ExtJS实现在GridForProjectLists.js文件中的。注意的是,我同时做了个ExtJS的ComboBox
          ComboBox实现:     

     1var storeDept = new Ext.data.Store({
     2         proxy: new Ext.data.HttpProxy({
     3                url:"../Projects/JsonDataSource/DepartmentInfo.aspx"
     4            }
    ),
     5            // create reader that reads the project records
     6            reader: new Ext.data.JsonReader({},[
     7                {name:'Text',type:'string'},
     8                {name:'Value',type:'string'}
     9         ])
    10    }
    );
    11    storeDept.load(); 
    12    
    13     var storeStatus = new Ext.data.Store({
    14         proxy: new Ext.data.HttpProxy({
    15                url:"../Projects/JsonDataSource/GetProjectStatus.aspx"
    16            }
    ),
    17            // create reader that reads the project records
    18            reader: new Ext.data.JsonReader({},[
    19                {name:'NAME',type:'string'},
    20                {name:'CODE',type:'string'}
    21         ])
    22    }
    );
    23    storeStatus.load();

       这里的实现了两个ComboBox,一个是部门选择,一个是状态选择。我这里只说其中一个数据源的写法,即GetProjectStatus.aspx。
       新建GetProjectStatus.aspx文件,代码如下:

    GetProjectStatus.aspx
     1using System;
     2using System.Data;
     3using System.Configuration;
     4using System.Collections;
     5using System.Linq;
     6using System.Web;
     7using System.Web.Security;
     8using System.Web.UI;
     9using System.Web.UI.WebControls;
    10using System.Web.UI.WebControls.WebParts;
    11using System.Web.UI.HtmlControls;
    12using System.Xml.Linq;
    13using BusinessObject.Projects;
    14using Database;
    15using Web.Components;
    16namespace Web.Projects.JsonDataSource
    17{
    18    public partial class GetProjectStatus : System.Web.UI.Page
    19    {
    20        protected string strJsonSource = string.Empty;
    21        protected void Page_Load(object sender, EventArgs e)
    22        {
    23            GetJsonSouceString();
    24        }

    25        
    26        //这些不用我注释了吧,呵呵
    27        private void GetJsonSouceString()
    28        {
    29            ProjectDictDataContext db = new ProjectDictDataContext();
    30            var query = from p in db.PROJECT_DICTs
    31                        where p.DICT_TYPE == "003"
    32                        select new { p.NAME, p.CODE };
    33            strJsonSource = query.ToJSON();
    34        }

    35    }

    36}

    37

    接下来,回到GridForProjectLists.js文件上,我们实现FORM,代码如下:
       

    Form表单实现