RadSpell for ASP.NET

Setting a Control to Check Send comments on this topic.
SpellChecking > Setting a Control to Check

Glossary Item Box

RadSpell can be easily configured to check any server- or client-side editable element, by setting its ControlToCheck property. to the ID of the respective element. By default every instance of RadSpell can check only one control. However, you can configure RadSpell to check multiple controls at once.

Example

The general way to set a control to check is by setting the ControlToCheck property directly in the RadSpell tag:

<asp:textbox id="TextBox1" runat="server" ... />
<rad:radspell id="RadSpell1" runat="server" controltocheck="TextBox1" />

 

Checking multiple controls at once

Using the client-side API of the control you can setup a text source for checking multiple controls at once:

<asp:textbox id="TextBox1" runat="server" ... />
<asp:textbox id="TextBox2" runat="server" ... />
<rad:radspell id="RadSpell1" runat="server" ... />

<script type="text/javascript">
/*<![CDATA[*/
function MultipleTextSource(sources)
{
 this.sources = sources;
 this.GetText = function()
 {
  var texts = [];
  for (var i = 0; i < this.sources.length; i++)
  {
   texts[texts.length] = this.sources[i].GetText();
  }
  return texts.join("<controlSeparator><br/></controlSeparator>");
 }
 this.SetText = function(text)
 {
  var texts = text.split("<controlSeparator><br/></controlSeparator>");
  for (var i = 0; i < this.sources.length; i++)
  {
   this.sources[i].SetText(texts[i]);
  }
 }
}

var spell = GetRadSpell(<%= RadSpell1.ClientID %>);
spell.SetTextSource(new MultipleTextSource([
 new HtmlElementTextSource(document.getElementById('<%= TextBox1.ClientID %>')),
 new HtmlElementTextSource(document.getElementById('<%= TextBox2.ClientID %>'))
]));
/*]]>*/
</script>