RadGrid for ASP.NET Ajax DataKeyNames case sensitivity

Posts   
 
    
erwin avatar
erwin
User
Posts: 21
Joined: 18-Feb-2005
# Posted on: 28-Dec-2015 19:23:16   

Hi, playing around with ASP.NET, Telerik UI for ASP.NET Ajax and llblgenprodatasource2 control.

Like some others in this forum I stumbled over the fact that DataKeyNames is case sensitive, while other names used for databinding are not.

The Grid bound to llblgenprodatasource2 quite nicely and everything worked except update and delete. Turned out, I had the DataKeyNames set to "ID" while the LLBLGen generated property was of course "Id".

If the the specified name is plain wrong, asp.net throws an error at me which is fine, but if it only differs by case, this is silently ignored and update/delete operations on llblgenprodatasource2 will just not work. What's the rationale behind this design?

Regards erwin

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 29-Dec-2015 16:12:17   

The problem is with entities which have properties which differ only by casing (so are the same as a field but differ only by casing.) This is an edge case though. The code simply checks whether a field is there with the name specified and if not, it assumes it's a property you want to set (added manually). If there isn't a property with the name in the set of properties found it skips it.

It's not the best design in the world, I fully admit that, as is the rest of the datasource control system from MS in general (which is mainly undocumented cruft so we had to trial/error our way into getting a working datasourcecontrol at all). It's quite complicated to get this right however, as the fields specified can also be nested properties in a referenced element. So it first checks whether there's a property at all with the given name. If not, it then checks whether it's a nested property and if not, it skips the field. We didn't decide to throw an exception. In hindsight we should have, or at least make it configurable, but as there's so much with these datasourcecontrols that can go wrong and it took so much time to get this working we didn't have enough time to add a deeply configurable system to the datasource controls.

As webforms/datasourcecontrols are deprecated by MS (no new code added in the future), we didn't make a lot of changes to them as well, as they work as expected at the moment, except for this particular issue.

So in short: no real rational reason except an edge case so we demand case sensitive correct names. This should have been done differently (i.e. case insensitive) but we didn't do this.

Frans Bouma | Lead developer LLBLGen Pro