Beispiel #1
0
        private void AddQueryResult(VLayoutPanel vPanel)
        {
            var btn = vPanel.Add(new DialogButton {
                Text = "增加记录", Url = "AddSettingDialog.aspx"
            }, new VLayoutOption(HorizontalAlign.Left));

            btn.Click += delegate { StartQuery(); };


            _mGrid = vPanel.Add(new DFBrowseGrid(new DFDataTableEditor())
            {
                Width = Unit.Percentage(100)
            });
            _mGrid.Columns.Add(new DFBrowseGridCustomExtColumn(delegate(DFDataRow row, HtmlTableCell cell, int rowIndex)
            {
                var delBtn = new LinkButton
                {
                    Text = "x"
                };
                delBtn.Click += delegate
                {
                    var id  = (long?)_mGrid.CurrentData.Data.Rows[rowIndex]["ID"];
                    var dom = new DQDeleteDom(typeof(Goods_Accounting_Store));
                    dom.Where.Conditions.Add(DQExpression.EQ(DQExpression.Field("ID"), DQExpression.Value(id)));
                    using (var session = Dmo.NewSession())
                    {
                        session.ExecuteNonQuery(dom);
                        session.Commit();
                    }
                    StartQuery();
                };
                delBtn.OnClientClick = "return confirm('确定删除吗?')";
                cell.Controls.Add(delBtn);
            }));
            _mGrid.Columns.Add(new DFBrowseGridAutoColumn());
        }