protected override void OnLoadControlComplete() { DetailGrid dGrid = this.EditForm.FindControl("OrderGrid") as DetailGrid; if (dGrid != null && !this.EditForm.IsReInitForm) { dGrid.ToolBars[0].Title = "选择下拨人员"; if (dGrid.ToolBars.Count > 1) { dGrid.ToolBars.Remove(dGrid.ToolBars[1]); } dGrid.AddToolBarItems(dGrid.ToolBars); double width = dGrid.ADGrid.Columns[dGrid.ADGrid.Columns.Count - 1].Width.Value; dGrid.ToolBarItemClick += new EventHandler <ToolBarItemClickEventArgs>(dGrid_ToolBarItemClick); //if (this.OrderEntity.FBEntityState != FBEntityState.Added) //{ // dGrid.ADGrid.Columns[5].Visibility = Visibility.Collapsed; //} //else //{ // dGrid.ADGrid.Columns[5].Visibility = Visibility.Visible; //} var totalWidth = dGrid.ADGrid.Columns.Sum(item => item.Width.Value); dGrid.ADGrid.MinWidth = totalWidth + 10; dGrid.ADGrid.LoadingRow += (object sender, DataGridRowEventArgs e) => { if (this.EditForm.OperationType == OperationTypes.Add || this.EditForm.OperationType == OperationTypes.Edit || this.EditForm.OperationType == OperationTypes.ReSubmit) { var con = dGrid.ADGrid.Columns[1].GetCellContent(e.Row) as StackPanel; ImageButton myButton = new ImageButton(); myButton.Margin = new Thickness(0); myButton.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png", Utility.GetResourceStr("DELETE")); myButton.Tag = e.Row.DataContext; myButton.Click += (oo, ee) => { Control c = oo as Control; var entity = c.Tag as FBEntity; Action action = () => { dGrid.Delete(new List <FBEntity> { entity }); // none; }; var personName = entity.GetObjValue("Entity.OWNERNAME"); var msg = "你确定要删除" + personName + "的个人活动经费下拨吗?"; CommonFunction.AskDelete(msg, action); }; con.Children.Clear(); con.Children.Add(myButton); } }; } if (this.EditForm.OperationType != OperationTypes.Add) { LookUp lu = this.EditForm.FindControl("AssignCompanyID") as LookUp; if (lu != null) { lu.IsEnabled = false; } } }