asp.net 2.0:ObjectDataSource 控件生成严格意义上的多层 Web 应用程序


WaitU@...(52748176) 11:47:36
ASP.NET 2.0 Framework 并利用 ObjectDataSource 控件生成严格意义上的多层 Web 应用程序。

做什么的,没有看明白
willsun(11757173) 11:48:34
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string mode = Request.Params["Mode"];
            if (!string.IsNullOrEmpty(mode) && mode == "Insert")
            {
                labStatus.Text = "增加";
                dvRole.ChangeMode(DetailsViewMode.Insert);
            }
            if (!string.IsNullOrEmpty(mode) && mode == "Update")
            {
                labStatus.Text = "修改";
                dvRole.ChangeMode(DetailsViewMode.Edit);
            }
            if (!string.IsNullOrEmpty(mode) && mode == "Browse")
            {
                labStatus.Text = "查看";
                dvRole.ChangeMode(DetailsViewMode.ReadOnly);
            }
        }
    }

    protected void ibOK_Click(object sender, ImageClickEventArgs e)
    {
        string mode = Request.Params["Mode"];
        if (!string.IsNullOrEmpty(mode) && mode == "Insert")
        {
            dvRole.InsertItem(true);
        }
        if (!string.IsNullOrEmpty(mode) && mode == "Update")
        {
            dvRole.UpdateItem(true);
        }
        Response.Redirect("~/RoleManager.aspx");
    }

    protected void ibCancel_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("~/RoleManager.aspx");
    }

    protected void dvRole_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        e.Values["RoleId"] = Guid.NewGuid();
    }
闲人(99282890) 11:48:38
ObjectDataSource 这个东西很好用
willsun(11757173) 11:49:10
这个是,添加修改查看的代码,少吧
WaitU@...(52748176) 11:49:34
添加和查看不需要新的页码?
WaitU@...(52748176) 11:49:49
也用2005,可是看来哦已经落伍了
willsun(11757173) 11:50:04
我用gridview和detailsview做,2个页面
╓jeky↓(7331756) 11:50:12
willsun这个真棒!
willsun(11757173) 11:50:18
呵呵
╓jeky↓(7331756) 11:50:32
ObjectDataSource 是.net2.0自带的?
willsun(11757173) 11:50:33
配上codesmith更棒
willsun(11757173) 11:50:36

╓jeky↓(7331756) 11:50:57
好!学学!
willsun(11757173) 11:51:06
我现在是用data application+codesmith+objectdatasource
willsun(11757173) 11:51:13
做东西很快
闲人(99282890) 11:51:15
ibatis

posted on 2006-09-08 13:35  duliang  阅读(185)  评论(0编辑  收藏  举报