To Install ASPNetSpell into an MVC Web Forms Application - follow the standard installation guide... with 2 exceptions.
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:
You can add ASPNetSpell.dll to the toolbox Right click on the Visual Studio ToolBox and pick "Choose Items..." and browse.
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>
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>
ASPNetSpell is also compatible with MVC3 Razor... but installation is a little different.
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.
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())