Firstly, Merry Christmas! Yup, it’s the season of X-Mas coding as I refer to it. Mostly, one fiddles around and tries new things …
For me, I looked closely at ASP.NET 2.0. Sadly, there are actually some things MS introduced that really make me ask myself if it is progress or a big step backwards. Furthermore, some bugs that seem to be in the framework since version 2.0 are still in 3.5 — big bugs.
So, let’s say you have a grid on your page and instead of having a button or a link with text that says “Delete” in a row to give the user the option to delete a row from the grid, you define an image. Perfect. It looks great. However, you always end up with an exception in your code at some point that you refer to a tuple that is not in the grid. “How can that be?” you ask yourself as the “Delete” text is only inserted in the grid if there actually is something to be deleted. If you debug your application you will soon find out that the event is called twice by the framework. Wow, you think that must be some new invention called “AutoEventWireup” that supports lazy programming in its best. Yes, since ASP.NET 2.0 you do not need to tell the framework “That method in my code, is supposed to be fired for that control with that event” — the framework parses the method names using reflection and then decides “Oh, goodie, that method must be called when the user deletes a row from the grid.” If you make the bad mistake of defining the event in the designer and have AutoEventWireup set to true — yup, it’s called once by your definition and again because of the automatic mechanism. But it gets worse…. Switch it off and for an ImageLink it will be called twice anyways. It’s a bug. Go to MSDN and you can read all about it. What concerns me is the fact that this bug is in there since 2005. What has MS done with its new innovative frameworks branded 3.0 and 3.5 ? Exactly. Nada. I changed the target to the respective version numbers, the bug prevails. So, what can you do as a developer? I don’t know, sadly, my users will have to live without nice glyph images in their grids now. I don’t care. I use a textual link now and it works. The event only fires once now.
This is yet again one of the many examples that some bugs are simply never addressed. Every software product has those. Be it Visual Studio or RAD Studio. So, my resolution for 2008 will be to do my best to report bugs in QC and RAID so that the next Delphi will fewer annoying bugs like that.
With CodeGear we have a great public bug tracking system called Quality Central - at Microsoft I am still looking for something similar, but have not found something except the MSDN user forums…

No comments
Comments feed for this article
Trackback link
http://www.flickdotnet.de/index.php/2007/12/aspnet-20-gridview-and-those-few-events-that-just-have-to-fire-twice-once-in-a-while/trackback/