Nanospell Spell Checking Software Components
JavaScript jQuery CKEditor TinyMCE PHP ASP.Net Classic ASP

The ASP.Net Spell Checker

ASPNetSpell & MVC Web Apps

300px


To Install ASPNetSpell into an MVC Web Forms Application - follow the standard installation guide... with 2 exceptions.

1. ASPNetSpellInclude

The ASPNetSpellInclude MUST be installed into your "Content" folder. The best way to do this is to drag-and-drop this folder into Solution Explorer from windows.


Normally you will not need to change the InstallationPath property.... ASPNetSpell will automatically detect the MVC application and find the spellchecker assets at /Content/ASPNetSpellInclude/

If deploying your MVC application in a virtual directory (below the root of the web site ) for should change the InstallationPath property to:


File:MVCSolutionExplorer.png



2. Form Context

You can add ASPNetSpell.dll to the toolbox Right click on the Visual Studio ToolBox and pick "Choose Items..." and browse.

File:MVCToolBox.png


In your view - you must wrap the ASPNetSpell controls with a server form tag

SourceCode:
<form id="Form1" runat="server">
       
<ASPNetSpell:SpellTextBox ID="SpellTextBox1" runat="server">Helloo Worlb.
</ASPNetSpell:SpellTextBox>
       
<ASPNetSpell:SpellButton ID="SpellButton1" runat="server" />

</form>

Best Practices

For MVC we highly recommend manually adding the file ~/ASPNetSpellInclude/include.js to your document in the file header.

SourceCode:
<head>
...
       
<script type="text/javascript" src="/ASPNetSpellInclude/include.js" />
...
</head>

Download An Example

ASPNetSpell & MVC3 Razor Applications

ASPNetSpell is also compatible with MVC3 Razor... but installation is a little different.

300px

1. ASPNetSpellInclude

The ASPNetSpellInclude folder MUST be copied into your "Content" folder. The best way to do this is to drag-and-drop this folder into Solution Explorer from windows.

File:MVC3SolutionExplorer.png


2. Add the ASPNetSpell.dll as a reference

Add the ASPNetSpell.dll as a reference to the project by right clicking on the project references in the Solution Explorer and browsing to the ASPNetSpell.dll you downloaded.

300px

3. Using ASPNetSpell in Razor

You can now add spell-checking buttons to your Razor views (pages) - and also add as-you-type spellchecking to any or all textareas in your veiws.


The classes to do this are in the ASPNetSpell.Razor namespace - and are rendered using the getHtml() function.

Read More about the ASPNetSpell.Razor API

E.g.

SourceCode:
<textarea id="TextArea1" cols="20" rows="2">Hallo Worlb.</textarea>

@{    
    ASPNetSpell.Razor.SpellButton MySpellButton = new ASPNetSpell.Razor.SpellButton();
    MySpellButton.InstallationPath = ("/Content/ASPNetSpellInclude");
    MySpellButton.FieldsToSpellCheck = "TextArea1";
}
@Html.Raw(MySpellButton.getHtml())


 
@{
      ASPNetSpell.Razor.SpellAsYouType MyAsYouType = new ASPNetSpell.Razor.SpellAsYouType();
      MyAsYouType.InstallationPath = ("/Content/ASPNetSpellInclude");
      MyAsYouType.FieldsToSpellCheck = "TextArea1";
}
@Html.Raw(MyAsYouType.getHtml())

4. Hello World

Build the project to see ASPnetSpell's As-You-Type and Spell-Button features working in ASP.Net MVC3

File:MVC3Result.png

Download An Example