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?

1 Answer 1


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");    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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