Datagrid, how to prevent deletion add additons

  • Thread starter Thread starter John
  • Start date Start date
Hi John,

It's simple:

CurrencyManager cm = (CurrencyManager)BindingContext[grid.DataSource,
grid.DataMember];
DataView view = (DataView)cm.List;

view.AllowNew = false;
view.AllowDelete = false;
 
Hi Dmitriy,

That doesn't seem to work I can still add and delete rows
from the grid, I do have a customised column (combobox)
would this make a difference?

John
-----Original Message-----
Hi John,

It's simple:

CurrencyManager cm = (CurrencyManager)BindingContext [grid.DataSource,
grid.DataMember];
DataView view = (DataView)cm.List;

view.AllowNew = false;
view.AllowDelete = false;

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE


John said:
Hi,

does anyone know how to prevent deletions and insertions
in a bound datagrid?

John

.
 
John,

A customized column should not affect this. What really matters is when you
execute those lines. I believe this should be done just after calling the
SetDataBinding method.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

John said:
Hi Dmitriy,

That doesn't seem to work I can still add and delete rows
from the grid, I do have a customised column (combobox)
would this make a difference?

John
-----Original Message-----
Hi John,

It's simple:

CurrencyManager cm = (CurrencyManager)BindingContext [grid.DataSource,
grid.DataMember];
DataView view = (DataView)cm.List;

view.AllowNew = false;
view.AllowDelete = false;

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE


John said:
Hi,

does anyone know how to prevent deletions and insertions
in a bound datagrid?

John

.
 
Back
Top