New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Spell Check RadGrid Editors

This demo illustrates how to spell check text input fields in RadGrid's edit form using RadSpell. This is useful when you would like to notify the end user when there are spelling mistakes in the text editor fields he/she uses to update/insert grid records.

The key moments are:

  • Attach a client script to the "Update" button in the grid's edit form (using asp HiddenField to store its id for this purpose).

  • Take advantage of RadSpell.ControlsToCheck property, add the ClientID's of all the textbox editors that should be checked.

  • Call the startSpellCheck() client method of RadSpell to check the specified input controls.

  • Raise a flag when the check is finished to update/insert the data.

Additionally, the grid and spell components are ajaxified using RadAjaxManager instance to perform the data editing operations with asynchronous requests. Here are the relevant code snippets from the online demo:

JavaScript
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">    
//boolean flag which determines whether the spell check has been processed or not  
var IsChecked = false;
//starts the spell check operation   
function StartCheck() {
  if (!IsChecked) {
    var spell = $find('<%= RadSpell1.ClientID %>');
    spell.startSpellCheck(); return false;
  } else { return true; }
}
function SpellCheckFinished(sender, args) {
  IsChecked = true;
}
function SpellCheckClosed(sender, args) {
  if (IsChecked) {
    //trigger submit from the update/insert button in the grid      
    //the id of the update or insert button is extracted from a hidden field   
    var buttonID = document.getElementById('<%=HiddenField1.ClientID %>').value;
    document.getElementById(buttonID).click(); IsChecked = false;
  }
}
</telerik:RadCodeBlock>
Not finding the help you need?
Contact Support