zondag, juli 22, 2007

 

The trouble with Anthem.NET editlabel

Today's programming struggle was all about getting the Anthem.NET editlabel component to work properly in my site. The idea of an 'edit in place' text on a site is just great. Image: instead of seeing an error in your question, going back to the form and changing it, you can now just click on the text and it changes in a textbox field that you can edit. How cool is that? The free Anthem.NET toolkit of Ajax controls for .NET provides the EditLabel control for this purpose.

Unfortunately it did not quite work out the way I wanted to. I have several of these controls on the same page, but only the last update would stick, the others would not get communicated to the server on a postback. So I started troubleshooting and looking for alternatives. (Problems can either be solved or avoided, both are valid options IMHO.) Nikhel.Net's blog has a similar script for download, but it was written on a beta version before the go-live of the AJAX.NET toolkit, so I did not trust it to run. I stumbled on the DTAjax project on Codeplex that has taken the previous script, updated it and included it in its tools. This control worked fine (almost hurray!), but only in IE and not in Firefox, so I decided not to use it either.

Finally I changed the code of the Anthem.NET EditLabel. By default it uses a proprietary feature of IE to support inline editing when it detects IE and supports a real textbox for other browsers. I disabled the IE detection in the source code and on my test page everything worked out fine. But ... not on the intended page. Now you can change sometimes one, sometimes a few, sometimes all... Before I go completely mad, I just leave it a 'documented bug for IE' of my site and move on...

Labels: ,