Hi Charles,
According to your description,
I understand that you want to make the DataTable as read only,
If I misunderstood anything here, please don't hesitate to correct me.
"myDataTable.DefaultView.AllowEdit = false" means that DataGrid or GridView
binding to this DataTable can not Edit.
But you still can edit the rows in DataTable by code.(e.g:
myDataTable[0][0] ="Try to Change"
So we suggest you can use the method ("DataTable.RejectChanges()") when
there is an event("DataTable.RowChanged") fired.
Such as:
myDataTable.RowChanged += new DataRowChangeEventHandler(dt_RowChanged);
void dt_RowChanged(object sender, DataRowChangeEventArgs e)
{
myDataTable.RejectChanges();
}
But the event "dt_RowChanged" will be fired twice.
The fist time is due to the statement "myDataTable.Rows[0][0] ='Try to
Change'".
And the second time is due to the method "DataTable.RejectChanges()".
If there is any question, please feel free to reply here and I am glad to
work with you.
Wen Yuan
===============================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
===============================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)