Datatable.BeginInit and EndInit
-
hi Can u please tell me the real life example for the begin init and end init utilization in datatable and in which situation it should be used. Thanks
If you want to change multiple properties of the DataView object but don’t want the changes to affect the data visible through the DataView until you’ve changed all of the desired properties, you can use the BeginInit and EndInit methods. For example, say you have a DataView bound to a particular DataTable and you’ve also set the DataView object’s RowFilter property so that only a small fraction of the rows are visible through the DataView. You’re displaying the contents of the DataView on a Windows form using a DataGrid, and based on input from the user you want to change the settings of the DataView object’s Table and RowFilter properties. In this situation, you should enclose the code that changes the DataView object’s properties within calls to the DataView object’s BeginInit and EndInit property to prevent the DataGrid from momentarily displaying all rows from the new DataTable. http://www.koopoo.cn/ASPNET/ADONET/adonethtml/32ch10f.htm[^]
rahul