试试看以下代码是否可以满足需求。
void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
if (e.Control is TextBoxEditingControl)
{
if (!object.Equals(this.gcMultiRow1.CurrentRow.Tag, "NewRow"))
{
(e.Control as TextBoxEditingControl).ReadOnly = true;
}
else
{
(e.Control as TextBoxEditingControl).ReadOnly = false;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
this.gcMultiRow1.Rows.Insert(0, 10);
for (int i = 0; i < 10; i++)
{
this.gcMultiRow1.Rows.Tag = "NewRow";
}
} |