Posted 14 August 2024, 4:26 pm EST - Updated 14 August 2024, 4:32 pm EST
Alright, so my previous issue being solved, I finally had a working C1GridView, and it filtered SLICK!
Awesome.
Because I’m a huge fan of “DRY” code and don’t like to re-write code bits over and over again, I had written a special static method years ago that’s served me well to “scrape” an entire GridView of data and shove it all in a DataTable. After I worked out the initial kinks in the method, it’s served me very well for years - until it came across the C1GridView.
I modified the method to just take in a C1GridView instead of a Microsoft GridView, and it doesn’t error, but it does provide some strange results.
Image 1 shows the onscreen results after I’ve filtered the results down to only those records that contain “1” within the description. This is the data that I want to “scrape” after the postback.
Image 2 shows the results in the Microsoft Data Visualizer for the DataTable that my code “scraped”. At first, I thought that there was something wrong with my method, so I dug in and investigated. If you run it yourself, and set a break-point at line 35 of ASP.cs, you’ll see that while the GridView DOES contain 11 rows after the post-back, it does indeed contain the FIRST eleven rows of the original dataset, NOT the filtered down dataset, just like it shows in the picture!
If you investigate each object and each control during runtime using the debugger and navigate through all of them, you’ll see that this is indeed true.
So, is there something that I’m missing here? How do I get the filtered down results from the GridView after postback?
I’ve uploaded a full “bare minimum reproducable” code based on the original code that Mescius sent me, with just “my” stuff added to their code to reproduce the error.
You can find the full code here on my GitHub: https://github.com/WestBennett/C1GridViewOddity
I’ll take it down when the issue is resolved.