I was able to create and add RadDocks dynamically to my RadZones. Contents of these dynamically created RadDocks are loaded from ascx files. Those ascx files contain RadGrids in them. I prefer using IDataReader's for the datasources of these RadGrids. However, once everything is rendered, I click "refresh" on a RadGrid and I receive the following error:
System.InvalidOperationException: Invalid attempt to FieldCount when reader is closed.
I get the same error when I click on delete icon for any row of the RadGrids...
I found out that this problem is caused by the fact that the IDataReader, the datasource, is closed once the DataBound event is completed.
I assign this IDataReader object to the DataSource field of the RadGrid in OnNeedDataSource event. I also created event methods for both DataBinding and DataBound and put some breakpoints to see what the problem is. I saw that once I click on "refresh" on a RadGrid, NeedDataSource, DataBinding and DataBound event methods were called respectively, however, strangely enough, another visit to DataBinding event method is performed (I don't know the source or the reason). This time, the system throws the error I described above because the DataReader is already closed after DataBound event...
What can be the reason for this?
Note: If I use DataTables instead of IDataReaders, everything works fine as expected ;)
Thanks in advance