You would think spell checking a text box on a web form would be a snap. Firefox manages to do it the background: simple, easy, and it always works. But Telerik decided to go a different way, the ridiculously hard way.
I’ve noticed that the more complex controls in Telerik’s ASP.NET suite actually render as three or four separate HTML elements. Typically one is visible and the others are hidden. It makes sense to do it this way if you need to store several disparate pieces of information, or you need to do a lot of juggling on the client to implement some magic piece of functionality. But it means updating the actual content is trickier. The RadSpell control works this way.
What I wanted to do was automatically update some text after the user initiated and completed a spell check. A Telerik knowledge base article suggested manually updating the text box from their RadSpell control’s client-side OnClientDialogClosing event handler. The problem there was that event doesn’t seem to exist. There’s an OnClientDialogClosed event, which I thought might be good enough, but no dice. I couldn’t get the text to update.
I dug a little deeper and found an alternate approach, one that would give the RadSpell control the ClientID of the text box to update so it could do it for you. That didn’t work out so well either. It would update the text but as soon as I clicked in the text box it would revert to the misspelled text.
After fiddling with it for the better part of an afternoon, I got it to work in both IE and Firefox using OnClientDialogClosed. I don’t know what I was missing before, but it now correctly updates the user’s text. Afterwards I had to wonder if there wasn’t a better way. Are today’s super-duper whiz-bang third-party controls just so complex that the simple things become the hardest?