SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a SharePointWebControls:UserField in a page layout that needs to be excluded from spell checking, as otherwise whenever a user is selected there are a large number of spelling errors are detected in the code-behind for the control.

It seems that in Sharepoint 2007 this behaviour could be implemented by using excludefromspellcheck = "true" but this doesn't seem to work for Sharepoint 2010. Has anyone come across the same problem and found a way around it?

share|improve this question
up vote 0 down vote accepted

I've found one work-around, which is to use javascript to inject the "excludeFromSpellCheck" attribute onto the html rendered for the control. I name the div around the asp control something distinctive, then when the page loads scripts run that get the wrapper then iterate across child elements of type input and textarea.


var containerElement = document.getElementById('excludeContentFromSpellCheck');

var inputNodeArray = containerElement.getElementsByTagName('input');
for (var i = 0; i < inputNodeArray.length; i++) {
  inputNodeArray[i].setAttribute("excludeFromSpellCheck", "true");    

var textNodeArray = containerElement.getElementsByTagName('textarea');
for (var i = 0; i < textNodeArray.length; i++) {
  textNodeArray[i].setAttribute("excludeFromSpellCheck", "true");    
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.