在数据表中的指定索引处插入一行,绑定到数据网格 [英] Inserting a row at specified index in a datatable, bound to a datagrid
问题描述
我有一个绑定到数据表的数据网格,它允许更新/删除记录而不是新行(使用下面的代码实现)。
datatable.defaultview.allownew = false
对于新行,用户已获得一个按钮,并且将使用以下代码在datatable中的指定索引处插入新行:
datatable。 rows.insertat()
这会在底部添加一行,除非我调用datatable.acceptchanges()。调用接受更改后,我可以在正确的位置看到行,但我无法编辑它。在编辑时,它抛出"对象引用未设置为对象的实例"。错误是未处理的。
任何人都可以建议解决方案..
问候
A_Kumar
任何人都可以就上述问题提出建议
I have a datagrid bound to a datatable which allows updating/deleting the records but not new rows (implemented using below code).
datatable.defaultview.allownew = false
For new rows, user has been given a button and new row will be inserted at a specified index in datatable using below code:
datatable.rows.insertat()
this adds a row at bottom unless I call datatable.acceptchanges(). After calling accept changes, I can see row at correct location but I am not able to edit it. On editing it throws "Object reference not set to an instance of the object." error which is unhandled.
Can anyone suggest a solution..
Regards
A_Kumar
can anyone please suggest something on above issue
这篇关于在数据表中的指定索引处插入一行,绑定到数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!