I have been developing a control, using Radgrid, which will get its list of columns and mappings from a database. We had previously done this using the Radgrid control, wrapped in a composite control, but there were several complications, the work arounds for which turned the control into a rather daunting piece of code. We also had many difficulties in getting the filtering to work properly with the dynamic databinding and the dynamic fields. The result of all this was a difficult to maintain code base, with no ability to do filtering (weren't using Linq at that time).
Since then, I have rewritten the control, removing much of the logic which was extraneous to the function of the grid, and made it to use databinding through Linq to an IEnumerable object. I had alot of success inheriting from Radgrid (which I know you don't officially support) and have followed the recommendations I could find as best I could. There's really only one issue now that I am having difficulty getting past, and I'm not really sure where to look.
When there is a postback from either the built in Radgrid sort or Paging, the very first record in the result gets duplicated when it is rendered. The dataset it is bound to has 100 records, yet it renders 101 records, with two occurances of the first record on the first page. If I do a postback using either of the other controls built in (like a custom checkbox column), then the first record is not duplicated. The same is true on consecutive searches, no duplicate record.
I was wondering if you had a hint as to where I can look to see the process of binding the datasource to the grid, or perhaps you have an idea as to what is differrent on a sort or paging event, as opposed to a CheckChanged event. The only thing I can see is that I am calling the Rebind method on the CheckChanged event (which is bubbled to the enclosing user control) and for the Radgrid Paging and Sorting postbacks it is calling CreateTableView and NeedDataSource. On CreateTableView, I am building a GridTableView object based on the configured columns in the database and returning this, and on the NeedDataSource I am pulling the datasource from the session (and have verified this contains only 100 records).
Any ideas would be appreciated.
Thanks,
Tyson Brown
Since then, I have rewritten the control, removing much of the logic which was extraneous to the function of the grid, and made it to use databinding through Linq to an IEnumerable object. I had alot of success inheriting from Radgrid (which I know you don't officially support) and have followed the recommendations I could find as best I could. There's really only one issue now that I am having difficulty getting past, and I'm not really sure where to look.
When there is a postback from either the built in Radgrid sort or Paging, the very first record in the result gets duplicated when it is rendered. The dataset it is bound to has 100 records, yet it renders 101 records, with two occurances of the first record on the first page. If I do a postback using either of the other controls built in (like a custom checkbox column), then the first record is not duplicated. The same is true on consecutive searches, no duplicate record.
I was wondering if you had a hint as to where I can look to see the process of binding the datasource to the grid, or perhaps you have an idea as to what is differrent on a sort or paging event, as opposed to a CheckChanged event. The only thing I can see is that I am calling the Rebind method on the CheckChanged event (which is bubbled to the enclosing user control) and for the Radgrid Paging and Sorting postbacks it is calling CreateTableView and NeedDataSource. On CreateTableView, I am building a GridTableView object based on the configured columns in the database and returning this, and on the NeedDataSource I am pulling the datasource from the session (and have verified this contains only 100 records).
Any ideas would be appreciated.
Thanks,
Tyson Brown