【发布时间】:2026-02-02 08:10:01
【问题描述】:
我以编程方式创建了一个 RadGrid 并尝试将 BatchEditCommand 绑定到它,但它没有更新并在单击多个保存后消失。 BatchEditCommand 根本没有触发,不知道触发了什么事件,我很难调试,也许我在创建 RadGrid 时错过了一些重要的设置?
for (int i = 1; i <= 1; i++)
{
strategy = strategy + Convert.ToString(i);
RadGrid RadGrid_Strategy = new RadGrid();
RadGrid_Strategy.ID = strategy;
RadGrid_Strategy.Skin = "Office2010Blue";
RadGrid_Strategy.GridLines = System.Web.UI.WebControls.GridLines.Both;
RadGrid_Strategy.DataSource = GetDataTableForStrategy(CY, i);
RadGrid_Strategy.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
RadGrid_Strategy.ShowHeader = false;
RadGrid_Strategy.BatchEditCommand += new GridBatchEditEventHandler(RadGrid_BatchEditCommand);
RadGrid_Strategy.MasterTableView.EditMode = GridEditMode.Batch;
RadGrid_Strategy.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Cell;
RadGrid_Strategy.AllowAutomaticUpdates = true;
RadGrid_Strategy.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
RadGrid_Strategy.MasterTableView.CommandItemSettings.ShowSaveChangesButton = true;
RadGrid_Strategy.MasterTableView.CommandItemSettings.ShowCancelChangesButton = true;
PlaceHolder1.Controls.Add(RadGrid_Strategy);
RadGrid_Strategy.Rebind();
}
BatchEditCommand 根本没有触发:
protected void RadGrid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
{...}
【问题讨论】:
标签: c# telerik-grid radgrid