|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: SpellCheck | SpellCheck | ASP.NET MVC | Syncfusion |
| 4 | +description: customization |
| 5 | +platform: ejmvc |
| 6 | +control: SpellCheck |
| 7 | +documentation: ug |
| 8 | +--- |
| 9 | + |
| 10 | +# Customization |
| 11 | + |
| 12 | +The Essential ASP.NET MVC SpellCheck provides option to customize for the following scenarios. |
| 13 | + |
| 14 | +* Misspell Word Appearance |
| 15 | +* Restrict Suggestion Count |
| 16 | + |
| 17 | +## Misspell Word Appearance |
| 18 | + |
| 19 | +The SpellCheck control provide the support(misspellWordCss) to display the error word in user defined style. By default displaying the error words with the red underline. |
| 20 | +The following code example depicts the way to customize the error word highlight (displaying error word with red color font and lightblue background). |
| 21 | + |
| 22 | +{% highlight CSHTML %} |
| 23 | + |
| 24 | +@section ControlsSection{ |
| 25 | +<div id="TextArea" contenteditable="true" name="sentence"> |
| 26 | + It is a concept vehicle with Liuid Silver body colour, 20-inch wheels, fabric foding roof, electrically-controlled hood, |
| 27 | + 4-cylinder 2.0 TDI engine rated 204 PS (150 kW; 201 hp) and 400 (295.02 lbf ft), diesel particulate filter and Bluetec emission control system, |
| 28 | + quattro permanent four-wheel drve system, Audi S tronic dual-clutch gearbox, McPherson-strut front axle and a four-link rear axle, Audi drive select system with 3 modes (dynamic, sport, efficiency), |
| 29 | + MMI control panel with touch pad and dual-view technology, sound system with the proinent extending tweeters. |
| 30 | +</div><br /> |
| 31 | + |
| 32 | + @Html.EJ().SpellCheck("TextArea").DictionarySettings(dic => dic.CustomDictionaryUrl("../api/SpellCheck/AddToDictionary").DictionaryUrl("../api/SpellCheck/CheckWords")).MisspellWordCss("highlight") |
| 33 | + |
| 34 | + |
| 35 | + @Html.EJ().Button("SpellCheck").Width("200px").Height("25px").Text("Spell check").ClientSideEvents(evet => evet.Click("contextMenu")) |
| 36 | +} |
| 37 | + |
| 38 | +@section ScriptSection{ |
| 39 | + <script type="text/javascript"> |
| 40 | + function contextMenu () { |
| 41 | + var spellObj = $("#TextArea").data("ejSpellCheck"); |
| 42 | + spellObj.validate(); |
| 43 | + } |
| 44 | + </script> |
| 45 | +} |
| 46 | +@section StyleSection{ |
| 47 | +<style> |
| 48 | + .highlight { |
| 49 | + background-color: lightblue; |
| 50 | + color: red; |
| 51 | + } |
| 52 | +</style> |
| 53 | +} |
| 54 | + |
| 55 | +{% endhighlight %} |
| 56 | + |
| 57 | +Once you have run the above code, you get an output like below. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +## Restrict Suggestion Count |
| 62 | + |
| 63 | +The SpellCheck control provides option (maxSuggestionCount) to restrict the count that the number of items displayed in the suggestion list. |
| 64 | +The following code example describes the way to control the suggestion count. |
| 65 | + |
| 66 | +{% highlight CSHTML %} |
| 67 | + |
| 68 | +@section ControlsSection{ |
| 69 | + |
| 70 | +<div id="TextArea" contenteditable="true" name="sentence"> |
| 71 | + It is a concept vehicle with Liuid Silver body colour, 20-inch wheels, fabric foding roof, electrically-controlled hood, |
| 72 | + 4-cylinder 2.0 TDI engine rated 204 PS (150 kW; 201 hp) and 400 (295.02 lbf ft), diesel particulate filter and Bluetec emission control system, |
| 73 | + quattro permanent four-wheel drve system, Audi S tronic dual-clutch gearbox, McPherson-strut front axle and a four-link rear axle, Audi drive select system with 3 modes (dynamic, sport, efficiency), |
| 74 | + MMI control panel with touch pad and dual-view technology, sound system with the proinent extending tweeters. |
| 75 | +</div><br /> |
| 76 | + |
| 77 | + @Html.EJ().SpellCheck("TextArea").DictionarySettings(dic => dic.CustomDictionaryUrl("../api/SpellCheck/AddToDictionary").DictionaryUrl("../api/SpellCheck/CheckWords")).MaxSuggestionCount(5) |
| 78 | + |
| 79 | + |
| 80 | + @Html.EJ().Button("SpellCheck").Width("200px").Height("25px").Text("Spell check").ClientSideEvents(evet => evet.Click("contextMenu")) |
| 81 | +} |
| 82 | + |
| 83 | +@section ScriptSection{ |
| 84 | + <script type="text/javascript"> |
| 85 | + function contextMenu () { |
| 86 | + var spellObj = $("#TextArea").data("ejSpellCheck"); |
| 87 | + spellObj.validate(); |
| 88 | + } |
| 89 | + </script> |
| 90 | +} |
| 91 | + |
| 92 | +{% endhighlight %} |
| 93 | + |
| 94 | +Once you have run the above code, you get an output like below. |
| 95 | + |
| 96 | + |
0 commit comments