ASPNetSpell & MVC


ASPNetSpell fully support MVC and provides ASP.Net spellchecking in MVC2, MVC3 and MVC3+Razor. Please follow the following integration guide - and download eh Hello-World tutorials.


ASPNetSpell & MVC Web Forms


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.


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

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>

Download An Example

ASPNetSpell & MVC3 Razor Applications

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

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.

  • Click "Rebuild Solution" at this point. ASPNetSpell.dll will automatically be copied into your /bin directory. This will activate Intelisense in Visual Studio - making coding much easier.

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.

  • You MUST set the InstallationPath property to "/Content/ASPNetSpellInclude".

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