ASPNetSpell and the .Net Razor Framework


ASPNetSpell if fully compatible with ASP.Nets new Razor framework.

ASPNetSpell & Razor Pages

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

300px

1. ASPNetSpellInclude

If you are using ASP.net MVC with Razor - please follow this guide...

The ASPNetSpellInclude folder should be installed into installed into application's root folder. The best way to do this is to drag-and-drop this folder into Solution Explorer from windows.


File:RazorSolutionExplorer.png

2. Add the ASPNetSpell.dll as a reference

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

250px

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

3. Using ASPNetSpell in Razor MVC Apps

You can now add spell-checking buttons to your Razor 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.

Note:

  • You must install ASPNetSpellInclide to the/Content/ASPNetSpellInclude
  • You must set InstallationPath = "/Content/ASPNetSpellInclude"

Read More about the ASPNetSpell.Razor API

E.g.

SourceCode:
@{  
  

    /// Create a ASPNetSpell spell- as-you-type feature for any textarea
    ASPNetSpell.Razor.SpellAsYouType mySpell = new ASPNetSpell.Razor.SpellAsYouType();
    mySpell.InstallationPath = ("/Content/ASPNetSpellInclude");
    mySpell.FieldsToSpellCheck = "TextArea1";


    /// Create a ASPNetSpell spellchecker button
    ASPNetSpell.Razor.SpellButton mySpellButton = new ASPNetSpell.Razor.SpellButton();
    mySpellButton.InstallationPath = ("/Content/ASPNetSpellInclude");
    mySpellButton.FieldsToSpellCheck = "TextArea1";
}
<p>
    ASP.NET Web Pages make it easy to build powerful .NET based applications for the web.
</p>
<textarea id="TextArea1" cols="20" rows="2">Helllo Worlb. 

@Html.Raw(mySpell.getHtml())

@Html.Raw(mySpellButton.getHtml())

4. Hello World

Build the solution to see ASPNetSpell working with Razor.

File:RazorHelloWorldResults.png

Download An Example