Aspx页面上常用的功能模块

☻列表页面中的——查询模块   1

 

<!--查询区域-->

<div class="panel search-panel">

    <div class="panel-content">

        <web:search runat="server" GridViewId="SGVEPSPOrderLineList" ID="GridSearch">

            <SearchConditionTemplate>

                <table>

                    <tr>

                        <th style="width: 100px;">

                            项目名称:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="PROJECT_NAME"></asp:TextBox>

                        </td>

                        <th style="width: 100px;">

                            标准产品名称:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="STD_PRD_NAME"></asp:TextBox>

                        </td>

                </table>

            </SearchConditionTemplate>

        </web:search>

    </div>

</div>

 

☻列表页面中的——查询模块   2

 

<!--查询区域-->

    <div class="panel search-panel">

        <div class="panel-content">

            <div class="toolbar toolbar-auto" sizcache="5" sizset="0">

                <table>

                    <tr>

                        <th style="width: 80px;">

                            项目编号:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="PRO_CODE"></asp:TextBox>

                        </td>

                        <th style="width: 80px;">

                            项目名称:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="PRO_NAME"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th style="width: 80px;">

                            合同编号:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="CT_NO"></asp:TextBox>

                        </td>

                        <th style="width: 80px;">

                            合同名称:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="CT_NAME"></asp:TextBox>

                        </td>

                        <td rowspan="1" valign="middle">

                            <asp:Button ID="btnSearch" CssClass="btn" runat="server" Text="查询" OnClick="Search" />

                            <asp:Button ID="btnReset" CssClass="btn" runat="server" Text="重置" OnClick="Reset" />

                        </td>

                    </tr>

                    <tr>

                        <th style="width: 80px;">

                            年份:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="YEAR" CssClass="Wdate" onfocus="WdatePicker({lang:'zh-cn',dateFmt:'yyyy'})"></asp:TextBox>

                        </td>

                        <th style="width: 80px;">

                            月份:

                        </th>

                        <td>

                            <asp:TextBox runat="server" ID="MONTH" CssClass="Wdate" onfocus="WdatePicker({lang:'zh-cn',dateFmt:'MM'})"></asp:TextBox>

                        </td>

                    </tr>

                </table>

            </div>

        </div>

    </div>

后台代码:

          protected void Page_Load(object sender, EventArgs e)

        {

            //首次进入列表页面时要有列表数据

            if (!IsPostBack)

            {

                this.initParams();

            }

        }

        private void initParams()

        {

            this.YEAR.Text = DateTime.Now.Year.ToString();

            this.MONTH.Text = DateTime.Now.Month.ToString();

            //this.SmartDataSource1.DataBind();

            this.SmartGridView1.DataBind();  

        }

        protected void Search(object sender, EventArgs e)

        {

            //this.SmartDataSource1.DataBind();

            this.SmartGridView1.DataBind();      这里注意:只要绑定了SmartGridView控件,该控件已经绑定了SmartDataSource,所以绑定SmartGridView

        }                                                                                 后SmartGridView就会请求SmartDataSource,SmartDataSource然后就会搜集页面上的参数,去查询数据库

        protected void Reset(object sender, EventArgs e)

        {

            /*重置*/

            this.PRO_CODE.Text = "";

            this.PRO_NAME.Text = "";

            this.CT_NO.Text = "";

            this.CT_NAME.Text = "";

            this.YEAR.Text = DateTime.Now.Year.ToString();

            this.MONTH.Text = DateTime.Now.Month.ToString();

            //this.SmartDataSource1.DataBind();

            this.SmartGridView1.DataBind();

        }

 

 

☻列表页面中的——列表显示模块(1)  (金额:居右     时间:居中      编号:居中)

 

 <!--列表区域-->

    <div class="panel grid-panel" id="gridcontent" style="overflow-x: hidden; overflow-y: auto;">

        <!--列表内容-->

        <div class="panel-content">

            <!--列表控件-->

            <web:SmartGridView runat="server" ID="SmartGridView1" AutoGenerateColumns="false"

                Width="100%" DataKeyNames="DEPT_ROJECT_ID" DataSourceID="SmartDataSource1" PageSize="7">

                <Columns>

<asp:TemplateField HeaderText="温馨提示内容" SortExpression="Content">

                        <ItemTemplate>

                            <asp:Label ToolTip='<%#Eval("Content").ToString() %>' ID="LabelContent1" runat="server"

                                Text='<%# ContentLength(Eval("Content").ToString())%>'></asp:Label>

                        </ItemTemplate>

                    </asp:TemplateField>

 

                    <asp:BoundField DataField="PRO_CODE" HeaderText="项目编号" SortExpression="PRO_CODE"

                        ItemStyle-HorizontalAlign="Center" />

                    <asp:BoundField DataField="PRO_NAME" HeaderText="项目名称" SortExpression="PRO_NAME"

                        ItemStyle-Width="350px" />

                    <asp:BoundField DataField="TOTAL_INVEST" HeaderText="项目总投资" SortExpression="TOTAL_INVEST"

                        ItemStyle-HorizontalAlign="Right" />

                    <asp:BoundField DataField="ISSUED_DATE" HeaderText="下达日期" SortExpression="ISSUED_DATE"

                        ItemStyle-Width="120px" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:yyyy-MM-dd}" />

                    <asp:BoundField DataField="DEPTNAME" HeaderText="所属科室" SortExpression="DEPTNAME"

                        ItemStyle-Width="100px" />

                    <asp:BoundField DataField="ProjectLeaderNames" HeaderText="项目负责人" SortExpression="ProjectLeaderNames"

                        ItemStyle-Width="200px" />

                    <asp:BoundField DataField="ProfessionText" HeaderText="所属专业" ItemStyle-HorizontalAlign="Center"

                        SortExpression="ProfessionText" ItemStyle-Width="80px" />

                    <asp:TemplateField HeaderText="操作">

                        <ItemStyle HorizontalAlign="Center" Wrap="false" />

                        <HeaderStyle Wrap="false" HorizontalAlign="Center" />

                        <ItemTemplate>

                            <table class="templete">

                                <tr>

                                    <td>

                                        <asp:ImageButton ID="ibEdit" runat="server" ToolTip="编辑" Visible='<%# Eval("Status").ToString().Trim()=="1"? true:false %>'

                                            _DEPT_ROJECT_ID='<%#Eval("DEPT_ROJECT_ID")%>' ImageUrl="~/Statics/images/com/dg_edit.gif"

                                            CausesValidation="False" OnClientClick="return openEditor(this, 'Edit');" OnClick="RefreshGrid">

                                        </asp:ImageButton>

                                    </td>

                                    <td>

                                        <asp:ImageButton ID="ibDelete" runat="server" ToolTip="移除" Visible='<%# Eval("Status").ToString().Trim()=="1"? true:false %>'

                                            ImageUrl="~/Statics/images/com/dg_del.gif" _DEPT_ROJECT_ID='<%#Eval("DEPT_ROJECT_ID")%>'

                                            CausesValidation="False" OnClientClick="return confirm('您确认要移除该项目吗?')" OnClick="DeleteDEPTROJECT">

                                        </asp:ImageButton>

                                    </td>

                                    <td>

                                        <asp:ImageButton ID="ibLookUp" runat="server" ToolTip="查看项目环节" _DEPT_ROJECT_ID='<%#Eval("DEPT_ROJECT_ID")%>'

                                            ImageUrl="~/Statics/images/com/dg_view.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'ReadOnly');">

                                        </asp:ImageButton>

                                    </td>

                                    <td>

                                        <span style='display: <%# Eval("idpiStatus").ToString()!="已启"? "inline" :"none" %>;'>

                                            <asp:ImageButton ID="EnableImageButton" ImageUrl='~/Statics/images/icon_tool_215.gif'

                                                runat="server" ToolTip="启用" _KeyId='<%#Eval("DEPT_ROJECT_ID")%>' CausesValidation="False"

                                                OnClick="EnableDEPT_ROJECT"></asp:ImageButton></span> <span style='display: <%# Eval("idpiStatus").ToString()=="已启"? "inline" :"none" %>;'>

                                                    <asp:ImageButton ID="DisableImageButton" runat="server" ToolTip="停用" _KeyId='<%#Eval("DEPT_ROJECT_ID")%>'

                                                        ImageUrl='~/Statics/images/icon_tool_080.gif' CausesValidation="False" OnClick="DisEnableDEPT_ROJECT">

                                                    </asp:ImageButton></span>

                                    </td>

                                    <td>

                                        <asp:ImageButton ID="ImageButton1" runat="server" Visible='<%# Eval("Status").ToString().Trim()=="1"? true:false %>'

                                            ToolTip="查看进度" _DEPT_ROJECT_ID='<%#Eval("DEPT_ROJECT_ID")%>' ImageUrl="~/Statics/images/icon_tool_027.gif"

                                            CausesValidation="False" OnClientClick="SeeProgress(this, 'ReadProgress');return false;">

                                        </asp:ImageButton>

                                    </td>

                                </tr>

                            </table>

                        </ItemTemplate>

                    </asp:TemplateField>

                </Columns>

                <EditRowStyle HorizontalAlign="Center" />

            </web:SmartGridView>

            <web:SmartSqlDataSource runat="server" ID="SmartDataSource1" SelectCommand="EPM.INVEST_DEPTProjectInfo.get"

                SelectCountCommand="EPM.INVEST_DEPTProjectInfo.list.count" DefaultSortExpression="DEPT_ROJECT_ID DESC"

                SelectCommandAutoPageWrap="true">

            </web:SmartSqlDataSource>

        </div>

    </div>

    <script type="text/javascript">

        /*打开编辑页面*/

        function openEditor(_this, action) {

            var url = "";

            //表单三种状态 FormViewMode : Insert/Edit/ReadOnly,

            var params = { FormViewMode: action };

            if (action == "Insert") {

                url = "~/Modules/EPM/ProjectList.aspx";

                params.title = "用户信息新增";

            } else if (action == "Edit") {

                url = "~/Modules/EPM/DEPTProjectInfoEidt.aspx";

                params.title = "部门投资项目信息编辑";

                params.Id = _this.attributes["_DEPT_ROJECT_ID"].value;

                params.FormViewMode = "Edit";

            } else if (action == "ReadOnly") {

                url = "ProjectPanoramicView.aspx";

                params.title = "项目信息查看";

                params.ProjectID = _this.attributes["_DEPT_ROJECT_ID"].value;

                window.open(buildUrl(url, params));

                return;

            }

            /*打开Dialog*/

            $.open(buildUrl(url, params), 800, null, { iframe: true }, function () {

                debugger;

                //执行回调刷新页面

   e             var args = $.dialogReturnValue();

                if (args) {

                    alert("添加项目成功!");

                    GridReloadBySearch("<%=GridSearch.ClientID %>" + '_ctl00_btnSearch');   这里注意:编辑完成后需要回调刷新

                }

            });

            return false;

        }

        function SeeProgress(_this, action) {

 

            var url = "";

            var params = { FormViewMode: action };

            if (action == "ReadProgress") {

                url = "ProjectProgressList.aspx";

                params.title = "项目形象进度列表";

                params.Id = _this.attributes["_DEPT_ROJECT_ID"].value;

            }

            //            window.open(url, name, features, replace);

            window.open(buildUrl(url, params));

            //window.open(buildUrl(url, params), "项目形象进度", "", false);

        }

                控制页面的样式:使页面能有滚动条

        window.onload = function () {

            if (document.parentWindow.frameElement == undefined) {

                return;

            }

            var bodywidth = document.parentWindow.frameElement.clientHeight;

            document.getElementById("gridcontent").style.height = bodywidth - document.getElementById("gridcontent").offsetTop;

        };

 

        $(window).resize(function () {

            if (document.parentWindow.frameElement == undefined) {

                return;

            }

            var bodywidth = document.parentWindow.frameElement.clientHeight;

            document.getElementById("gridcontent").style.height = bodywidth - document.getElementById("gridcontent").offsetTop;

        });

    </script>

 

☻列表页面中的——列表显示模块(2) 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DeptAbbreInfo.aspx.cs"

    Inherits="OEEPP.WebApp.Modules.SecurityConsole.SystemSetting.DeptAbbreInfo" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>部门简介配置</title>

    <link href="../../../App_Themes/blue/style.css" rel="stylesheet" type="text/css" />

    <web:Script ID="Script1" src="~/Scripts/jquery.js" runat="server" />

    <web:Script ID="Script7" src="~/Scripts/jquery.utils.js" runat="server" />

    <web:Script ID="Script2" src="~/Widgets/Validator/jquery.tipsy.js" runat="server" />

    <web:Script ID="Script3" src="~/Widgets/Validator/jquery.validation.js" runat="server" />

    <web:Script ID="Script4" src="~/Widgets/Validator/jquery.validationConfig.js" runat="server" />

    <web:Script ID="Script6" src="~/Scripts/common.js" runat="server" />

</head>

<body>

    <form id="form1" runat="server">

    <div class="webpart_03">

        <div class="wp_top">

            <div class="top">

                <h1>

                    部门简介列表</h1>

            </div>

        </div>

        <div class="wp_main">

            <div>

                <div class="search" style="margin-top: 2px;">

                    <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">

                        <SearchConditionTemplate>

                            <table cellpadding="0" cellspacing="0" width="95%">

                                <tr>

                                    <th>

                                        部门名称:

                                    </th>

                                    <td>

                                        <asp:TextBox ID="DeptName" name="DeptName" runat="server" MaxLength="50"></asp:TextBox>

                                        <span id="ChooseSpan" runat="server"
style="cursor: hand;">

                                        <a onclick="OpenSelectBookTypeWindow();">

                                            <img src="../../../Images/add_user.png" alt="选择部门" />

                                        </a>

                                        </span>

                                    </td>

                                </tr>

                            </table>

                        </SearchConditionTemplate>

                    </web:search>

                </div>

                <div class="toolbar" style="height: 30px; text-align: right;">

                    <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return openEditor(this, 'Insert');"

                        OnClick="SearchGrid">

                        <span>

                            <img alt="" runat="server" id="img1" src="~/Images/icon_new.gif" style="border: 0px" />新建

                        </span>

                    </asp:LinkButton>

                    <%--  <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="return delRoles();"

                        OnClick="DelRoles">

                        <span>

                            <img id="Img2" alt="" runat="server" src="~/Images/ico_del.gif" style="border: 0px" />删除

                        </span>

                    </asp:LinkButton>--%>

                </div>

                <div>

                    <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"

                        OnRowCommand="SmartGirdView1_RowCommand" RowStyle-CssClass="dg_itemstyle" DataSourceID="SmartDataSource1"

                        Width="100%" DataKeyNames="DeptID" PageSize="10">

                        <Columns>

                            <asp:BoundField DataField="DeptName" ItemStyle-Width="15%" HeaderText="部门名称" SortExpression="Name"

                                ItemStyle-HorizontalAlign="Center" />

                            <asp:BoundField DataField="Introduce" HeaderText="部门简介" ItemStyle-Width="80%" SortExpression="Name"

                                ItemStyle-HorizontalAlign="Left" />

                            <asp:TemplateField HeaderText="操作">

                                <ItemStyle HorizontalAlign="Center" Width="50" />

                                <HeaderStyle Wrap="False" HorizontalAlign="Center" />

                                <ItemTemplate>

                                    <asp:ImageButton ID="ibtnEdit" runat="server" ToolTip="修改" _DeptID='<%#Eval("DeptID")%>'

                                        ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Edit');"

                                        OnClick="RefreshGrid"></asp:ImageButton>

                                    <asp:ImageButton ID="ImageButton2" runat="server" _DeptID='<%#Eval("DeptID")%>' ToolTip="删除"

                                        ImageUrl="~/images/com/dg_del.gif" OnClientClick="javascript:return confirm('您确认要删除此部门简介吗?')"

                                        CausesValidation="False" CommandArgument='<%#Eval("DeptID")%>' CommandName="DeleteDeptInfo">

                                    </asp:ImageButton>

                                </ItemTemplate>

                            </asp:TemplateField>

                        </Columns>

                        <PagerSettings />

                        <EditRowStyle HorizontalAlign="Center" />

                    </web:SmartGridView>

                    <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="DeptArea.DeptInfo.List"

                        SelectCountCommand="DeptArea.DeptInfo.List.Count" SelectCommandAutoPageWrap="true"

                        DefaultSortExpression="UpdateTime desc">

                    </web:SmartSqlDataSource>

                </div>

            </div>

        </div>

        <div class="wp_foot">

            <div class="foot">

            </div>

        </div>

    </div>

    <script type="text/javascript">

        function openEditor(_this, action) {

            var params = { FormViewMode: action };

            if (action == "Insert") {

                params.title = "新增部门简介";

                var url = "../../DeptArea/Setting/DeptIntroSetting.aspx?Action=Insert&&title=" + params.title;

                var returnvalue = window.open(url, "_blank", "width=570,height=380,top=" + (window.screen.availHeight - 400) / 2 + ",left=" + (window.screen.availWidth - 300) / 2 + ",toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=yes");

            } else if (action == "Edit") {

                params.DeptID = _this.attributes["_DeptID"].value.toString();

                params.title = "修改部门简介";

                var url = "../../DeptArea/Setting/DeptIntroSetting.aspx?Action=Edit" + "&&title=" + params.title + "&&DeptID=" + params.DeptID;

                window.open(url, "_blank", "width=570,height=380,top=" + (window.screen.availHeight - 400) / 2 + ",left=" + (window.screen.availWidth - 300) / 2 + ",toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=yes");

            }

            return true;

 

        }

 

        function OpenSelectBookTypeWindow() {

            var returnValue = window.showModalDialog("../../KnowledgeSupermarket/GetOrganizationType.aspx", '', 'help:0; status:0; dialogWidth:400px; dialogHeight:500px; scroll:no;');

            if (returnValue) {

                document.getElementById("GridSearch_ctl00_DeptName").value = returnValue.DeptName;

            }

            return false;

        }

    </script>

    </form>

</body>

</html>

 

后台代码:

 

 protected void SearchGrid(object sender, EventArgs e)

        {

            this.GridSearch.Search();

        }

 

        protected void RefreshGrid(object sender, EventArgs e)

        {

            this.GridSearch.Refresh();

        }

 

                //一定要掌握

        protected void SmartGirdView1_RowCommand(object sender, GridViewCommandEventArgs e)

        {

            if (e.CommandName == "DeleteDeptInfo")

            {

                string DeptID = e.CommandArgument.ToString();

                var param = new Dictionary<string, object>() { { "DeptID", DeptID } };

                Dao.Get().ExecuteNonQuery("DeptArea.DeptInfo.Delete", param);//删除

                this.GridSearch.Refresh();

            }

        }

 

 

 ☻  用户控件的使用——对外公开属性

<!--通过属性将值赋给页面上的隐藏域,SmartSqlDataSource会自动获取页面上的隐藏域中的值用于查询数据库获取数据-->

<asp:HiddenField ID="OrderID" runat="server" />

 

 protected void Page_Load(object sender, EventArgs e)

        {

            if (!this.IsPostBack)

            {

                _ProjectID = Request["ProjectID"] == null ? string.Empty : Request["ProjectID"].ToString();

                this.ContractProjectList.ProjectId = _ProjectID;

                this.ContractRealPayList.ProjectId = _ProjectID;

                this.ConstractTemporarilyEstimateList.ProjectId = _ProjectID;

            }

        }

        // 是将 请求的参数ID保存在ViewState中了   

         protected string _ProjectID

        {

            get { return ViewState["ProjectID"] == null ? string.Empty : ViewState["ProjectID"].ToString(); }

            set { ViewState["ProjectID"] = value; }

        }

 

 

☻  页面中的弹窗方式(含弹出页面、弹出模态对话框)

<script type="text/javascript">

    /*打开编辑页面*/

             function openRequestOrder(_this, action) {

        var url = "";

        //表单三种状态 FormViewMode : Insert/Edit/ReadOnly,

        var params = { FormViewMode: action };

        if (action == "ReadOnly") {

            url = "../../Modules/EPSP/RequestOrderProductDetail.aspx";

            params.title = "请购产品明细";

            params.TORDER_ID = _this.attributes["_TORDER_ID"].value;

        }

        window.open(buildUrl(url, params));

 

        //        /*打开Dialog*/

        //        $.open(buildUrl(url, params), 800, null, { iframe: true }, function () {

        //            //执行回调刷新页面

        //            var args = jQuery.dialogReturnValue();

        //            if (args) {

        //                GridReload("<%=GridSearch.ClientID%>");

        //            }

        //        });

        //        return false;

    }

</script>

 

☻ 后台的常用功能代码——基于ImageButton的删除

 /*删除*/

        protected void DeleteDEPTROJECT(object sender, EventArgs e)

        {

            ImageButton ctr = sender as ImageButton;//是为了获得ImageButton 属性里的_DEPT_ROJECT_ID属性

            String DEPT_ROJECT_ID = ctr.Attributes["_DEPT_ROJECT_ID"];

            _DEPT_ROJECTServie.DeleteDEPTROJECT(DEPT_ROJECT_ID);

            GridSearch.Search(); //删除后再刷新一下列表

        }

  /*启用一条记录*/

                 protected void EnableDEPT_ROJECT(object sender, EventArgs e)

        {

            ImageButton img = (ImageButton)sender;

            string _DEPT_ROJECT_ID = img.Attributes["_KeyId"];

            int re = 0;

 

            re=this._DEPT_ROJECTServie.EnableDEPT_ROJECT(_DEPT_ROJECT_ID);

            if (re > 0)

            {

                ScriptHelper.Alert(this.Page, "启用成功!");

            }

            else

            {

                ScriptHelper.Alert(this.Page, "启用失败!");

            }

            this.GridSearch.Refresh();

        }

  /*禁用一条记录*/

        protected void DisEnableDEPT_ROJECT(object sender, EventArgs e)

        {

            ImageButton img = (ImageButton)sender;

            string _DEPT_ROJECT_ID = img.Attributes["_KeyId"];

            int re = 0;

            re = this._DEPT_ROJECTServie.DisEnableDEPT_ROJECT(_DEPT_ROJECT_ID);

            if (re > 0)

            {

                ScriptHelper.Alert(this.Page, "禁用成功");

            }

            else

            {

                ScriptHelper.Alert(this.Page,"禁用失败");

            }

            this.GridSearch.Refresh();

        }

  /*保存——通过事务的方式操作数据库*/

                  private readonly Dao _dao = Dao.Get();

         public String SaveOrUpdateDEPTROJECT(DEPTProjectInfo projectinfo)

        {

            TransactionOptions transactionOptions = new TransactionOptions();

            transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

            transactionOptions.Timeout = new TimeSpan(0, 3, 0);

            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))

            {

                if (string.IsNullOrEmpty(projectinfo.DEPT_ROJECT_ID))

                {

                    projectinfo.DEPT_ROJECT_ID = Guid.NewGuid().ToString();

                    this._dao.ExecuteNonQuery("EPM.INVEST_DEPTProjectInfo.insert", projectinfo);

                }

                else

                {

                    this._dao.ExecuteNonQuery("EPM.INVEST_DEPTProjectInfo.update", projectinfo);

                }

                transactionScope.Complete();

            }

            return projectinfo.DEPT_ROJECT_ID;

        }

☻编辑页面的数据显示

 

 protected void Page_Load(object sender, EventArgs e)

        {

            //通过DataSource绑定方式初始化Form后,如果存在其它更复杂的属性,可通过此方式进行初始化

            if (!IsPostBack && SmartForm.IsEdit())

            {

                //如果不需要对数据做深加工,可以直接利用工具类SmartForm提供的静态Fill方法填充Container容器

                var param = new Dictionary<string, object>();

                param.Add("DEPT_ROJECT_ID", Request["Id"] ?? string.Empty);

 

                SmartForm.Fill(container, "EPM.INVEST_DEPTProjectInfo.get", param);

            }

        }

 

☻编辑页面的表单

<asp:Content ContentPlaceHolderID="Content" ID="idFormMain" runat="server">

    <!--Dialog标题-->

    <div class="page-title">

        <h2>

            <%=Request["title"]%></h2>

    </div>

    <!--Dialog内容-->

    <div id="container" runat="server">

        <!--表单内容-->

        <asp:TextBox ID='ContractProjectID' Name="ContractProjectID" runat='server' Visible="false"></asp:TextBox>

        <div class="panel form-panel">

            <div class="panel-content">

                <!--表单使用table布局,col4:四列,col2:两列-->

                <table class="form-table col4">

                    <tr>

                        <th>

                            <label class="control-label">

                                项目编号:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="PRO_CODE" runat="server" Name="PRO_CODE" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                        <th>

                            <label class="control-label">

                                项目名称:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="PRO_NAME" runat="server" Name="PRO_NAME" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th>

                            <label class="control-label">

                                合同编号:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="CT_NO" runat="server" Name="CT_NO" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                        <th>

                            <label class="control-label">

                                合同名称:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="CT_NAME" runat="server" Name="CT_NAME" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th>

                            <label class="control-label">

                                合同总投资:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="COUNT_FRAMEACOUNT" runat="server" Name="COUNT_FRAMEACOUNT" Width="230px"

                                Enabled="false"></asp:TextBox>

                        </td>

                        <th>

                            <label class="control-label">

                                合同项目金额:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="PROJECT_MONEY" runat="server" Name="PROJECT_MONEY" Width="230px"

                                Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th>

                            <label class="control-label">

                                合同审核开始时间:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="APPROVE_BEGIN_DATE" runat="server" Name="APPROVE_BEGIN_DATE" Width="230px"

                                Enabled="false"></asp:TextBox>

                        </td>

                        <th>

                            <label class="control-label">

                                合同审核结束时间:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="APPROVE_END_DATE" runat="server" Name="APPROVE_END_DATE" Width="230px"

                                Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th>

                            <label class="control-label">

                                合同类型:

                            </label>

                        </th>

                        <td>                           

                                                                <asp:DropDownList runat="server" ID="DL_projectContratClass" DataSourceID="PROJECTCONTRACTCLASS"

                                Name="PROJECTCONTRACTCLASS" DataTextField="text" DataValueField="Id" data-validator="required[请选择部门]">

                            </asp:DropDownList>      这里注意:编辑页面弹出时DropDownList中有值,则需要给他的Name属性赋上value值而不是Text值

                        </td>

                        <th>

                            <label class="control-label">

                                合同属性:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="IS_FRAME_CT_NAME" runat="server" Name="IS_FRAME_CT_NAME" Width="230px"

                                Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                    <tr>

                        <th>

                            <label class="control-label">

                                项目负责人:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="UName" runat="server" Name="UName" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                        <th>

                            <label class="control-label">

                                是否完成分类:

                            </label>

                        </th>

                        <td>

                            <asp:TextBox ID="IsPCTCLASS" runat="server" Name="IsPCTCLASS" Width="230px" Enabled="false"></asp:TextBox>

                        </td>

                    </tr>

                </table>

            </div>

            <div class="panel-foot">

                <div class="form-actions col4">

                    <asp:Button ID="btnSave" CssClass="btn btn-primary" runat="server" Text="确定" OnClientClick="return validateForm();"

                        OnClick="SaveOrUpdateContractProject" />

                    <input type="button" class="btn" value="关闭" onclick="closeDialog()" />

                </div>

            </div>

        </div>

    </div>

    <web:SmartSqlDataSource runat="server" ID="PROJECTCONTRACTCLASS" SelectCommand="cms.ContractInfo.project.PROJECTCONTRACTCLASS"

        SelectCommandAutoPageWrap="false">

    </web:SmartSqlDataSource>

</asp:Content>

 

☻编辑页面中的  DataDictionaryDropDownList在编辑时显示编辑记录的值,只需要Name属性为数据源的value值而不是Text

                       <web:DataDictionaryDropDownList ID='PROFESSION'  runat='server' Width="240px" DictionaryCode='PROFESSION'

                                 Name="PROFESSION" data-validator="required">

                                <asp:ListItem Value="" Text="--请选择--"></asp:ListItem>

           </web:DataDictionaryDropDownList>

☻iframe框架页面的src属性

src 属性规定在 iframe中显示的文档的 URL。

 

 <div id="tab1">

        <table cellspacing="0" cellpadding="0" width="100%" style="border-left: 1px solid #9B9B9B;

            border-right: 1px solid #9B9B9B;">

            <tr>

                <td style="height: 1px; background-color: #C2D6EF; overflow: hidden">

                </td>

            </tr>

            <tr>

                <td valign="top" style="border-top: 1px solid #9B9B9B; padding: 5px 2px 5px 2px;">

                    <iframe id="showtabpage" scrolling="auto" onresize="this.height=changeFrmHeight()-20;"

                        onload='if(frmHeight &gt; 0) this.height=frmHeight-20' src="DEPTProjectDetail.aspx?_ProjectID=<%=_ProjectID%>"

                        frameborder="0" width="100%"></iframe>

                </td>

            </tr>

        </table>

    </div>

//Asp页面上图片绑定图片路径

<img src=<%# Eval("ThemeImg" )!=null? Eval("ThemeImg"):"../../Statics/FrontBBS/images/icon01.jpg"%> />

posted @ 2013-11-26 22:54  weifb  阅读(748)  评论(0)    收藏  举报