Attention: We are retiring the ASP.NET Community Blogs. Learn more >

AddNew vs. NewRow

These 2 methods have confused me for a while.  I assumed under the covers calls to AddNew created a new DataRow, marked as Detached, just like a call to NewRow does.

A control does not work directly with a DataTable .  When you bind a control, a DataView is created and the controls interacts with the datatable through that view.

So, calls to AddNew are interacting with the DataView, not the DataTable.  AddNew creates a new DataRowView

Public Overridable Function AddNew() As DataRowView

So, you will be working with a DataRowView, not a DataRow, on calls to AddNew.

2 Comments

Comments have been disabled for this content.