これが私のシナリオです。編集可能なフィールドが1つしかない(残りは読み取り専用に設定されている)radgridがあるので、編集モードのときに1つの許可された編集が表示されます。しかし、挿入(追加)を実行しようとすると、挿入用の1つのフィールドしか表示されませんが、他のすべてのフィールドも必要です。
再バインドを行わずに、ItemCommandイベント中に読み取り専用属性をプログラムで切り替えるにはどうすればよいですか?
興味のある人のために、ここに解決策があります(カスタムテンプレートに頼ることなく)。これにより、列の元の状態が読み取り専用から編集可能な状態に変更されます。
protected void rgvDepts_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName.Equals(RadGrid.InitInsertCommandName))
{
GridCommandItem item = e.Item as GridCommandItem;
GridTableView masterTable = item.OwnerTableView;
GridBoundColumn gbc = null;
if (item != null && masterTable != null)
{
gbc = (GridBoundColumn)masterTable.GetColumn("LIFNR");
if (gbc != null)
{
gbc.ReadOnly = false;
gbc.Visible = true;
}
}
}
}