Example #1
0
        private void InitializeCustomControls()
        {
            //初始化ToolBar
            InitToolBar();

            //初始化spgvMaterial
            this.spgvMaterial = new SPGridView();
            this.spgvMaterial.AutoGenerateColumns = false;
            this.spgvMaterial.Attributes.Add("style", "word-break:keep-all;word-wrap:normal");
            this.spgvMaterial.RowDataBound += new GridViewRowEventHandler(spgvMaterial_RowDataBound);

            BoundField bfColumn;

            foreach (var kvp in ShowTlist)
            {
                bfColumn            = new BoundField();
                bfColumn.HeaderText = kvp.Split(':')[0];
                bfColumn.DataField  = kvp.Split(':')[1];
                this.spgvMaterial.Columns.Add(bfColumn);
            }

            //加入仓库列
            TemplateField tfStorage = new TemplateField();

            tfStorage.HeaderText   = "仓库";
            tfStorage.ItemTemplate = new MulDropDownListTemplate(DataControlRowType.DataRow, "DDLStorage");
            this.spgvMaterial.Columns.Insert(6, tfStorage);

            //加入垛位列
            TemplateField tfPile = new TemplateField();

            tfPile.HeaderText   = "垛位";
            tfPile.ItemTemplate = new MulDropDownListTemplate(DataControlRowType.DataRow, "DDLPile");
            this.spgvMaterial.Columns.Insert(7, tfPile);

            //加入备注列
            TemplateField tfRemark = new TemplateField();

            tfRemark.HeaderText   = "备注";
            tfRemark.ItemTemplate = new TextBoxTemplate("备注", DataControlRowType.DataRow, "Remark");
            this.spgvMaterial.Columns.Insert(9, tfRemark);

            btnOK               = (Button)GetControltByMaster("btnOK");
            btnOK.Click        += new EventHandler(btnOK_Click);
            btnOK.OnClientClick = "return VerifyDDL()";
            (GetControltByMaster("ltrJS") as Literal).Text = JSDialogAid.GetVerifyDDLJSForBtn("--请选择--", "请为物资选择要存放的仓库或垛位!");

            chbCheck = (CheckBox)GetControltByMaster("chbCheck");
            chbCheck.CheckedChanged += new EventHandler(chbCheck_CheckedChanged);

            lblProblem = (Label)GetControltByMaster("lblProblem");
            txtProblem = (TextBox)GetControltByMaster("txtProblem");
        }
Example #2
0
        private void InitToolBar()
        {
            //添加按钮到toolbar
            ToolBar tbarTop = (ToolBar)GetControltByMaster("tbarbusiness");
            //新建
            ToolBarButton tbarbtnAdd = (ToolBarButton)this.Page.LoadControl("~/_controltemplates/ToolBarButton.ascx");

            tbarbtnAdd.ID       = "AddNewRow";
            tbarbtnAdd.Text     = "新建";
            tbarbtnAdd.ImageUrl = "/_layouts/images/newitem.gif";
            tbarbtnAdd.Click   += new EventHandler(tbarbtnAdd_Click);
            tbarTop.Buttons.Controls.Add(tbarbtnAdd);


            //删除
            ToolBarButton tbarbtnDelete = (ToolBarButton)this.Page.LoadControl("~/_controltemplates/ToolBarButton.ascx");

            tbarbtnDelete.ID       = "DeleteRow";
            tbarbtnDelete.Text     = "删除";
            tbarbtnDelete.ImageUrl = "/_layouts/images/delete.gif";
            tbarbtnDelete.Click   += new EventHandler(tbarbtnDelete_Click);
            StringBuilder sbScript = new StringBuilder();

            sbScript.Append("var aa= window.confirm('确认删除所选项?');");
            sbScript.Append("if(aa == false){");
            sbScript.Append("return false;}");
            tbarbtnDelete.OnClientClick = sbScript.ToString();
            tbarTop.Buttons.Controls.Add(tbarbtnDelete);

            //返回
            ToolBarButton tbarbtnBack = (ToolBarButton)this.Page.LoadControl("~/_controltemplates/ToolBarButton.ascx");

            tbarbtnBack.ID            = "backRow";
            tbarbtnBack.Text          = "确认并返回";
            tbarbtnBack.ImageUrl      = "/_layouts/images/BACK.GIF";
            tbarbtnBack.Click        += new EventHandler(tbarbtnBack_Click);
            tbarbtnBack.OnClientClick = "return VerifyDDL()";
            (GetControltByMaster("ltrJS") as Literal).Text = JSDialogAid.GetVerifyDDLJSForBtn("--请选择--", "请为维修保养的物资选择生产厂商!");
            tbarTop.Buttons.Controls.Add(tbarbtnBack);


            ToolBarButton btnRefresh = (ToolBarButton)this.Page.LoadControl("~/_controltemplates/ToolBarButton.ascx");

            btnRefresh.ID       = "btnRefresh";
            btnRefresh.Text     = "刷新";
            btnRefresh.ImageUrl = "/_layouts/images/refresh.GIF";
            btnRefresh.Padding  = "0,5,0,0";
            btnRefresh.Click   += new EventHandler(btnRefresh_Click);
            tbarTop.RightButtons.Controls.Add(btnRefresh);
        }