Spell Check not happening on asp text box

8 posts, 1 answers
  1. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 11 Jun 2012 Link to this post


    Any reply on this ?
    Hi ,

    I have a scenario where i need to do spell check for text entered in Asp textbox.. I am using combination of textbox and radspell
    as below. But this is not working.

            function SpellCheckDone() {
    var radTextBox1 = document.getElementById("<%=rdTxtBox.ClientID %>")
    radTextBox1.updateDisplayValue();
    }


     <asp:TextBox ID="rdTxtBox" runat="server" TextMode="MultiLine"></asp:TextBox>
                <telerik:RadSpell ID="rdspell1" runat="server" ControlToCheck="rdTxtBox" SpellCheckProvider="PhoneticProvider"
                SupportedLanguages ="en-US,English" OnClientDialogClosed="javascript:SpellCheckDone()" ButtonType="None"/>

    Do i need to do anything further. Please help.

    Regards,
    Akki
  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 13 Jun 2012 Link to this post

    Hi,

    The OnClientDialogClosed event of RadSpell is fired when closing RadSpell dialog.
    The updateDisplayValue() method is not needed, because the standard ASP.NET TextBoxes do not have such a client side method.

    What you should do is to set
    <telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1" />
    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>

    When pressing the Spell Check button, RadSpell will be opened and the user will be able to spellcheck the contents of the textbox.

    If you want to launch the spellchecker when the textbox loses focus, you should attach to its blur event and launch the spellchecker, e.g.

    <telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1" />
    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>
    <script type="text/javascript">
    function pageLoad() {
        $telerik.$("#TextBox1").on("blur", function (e) {
            GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck();
        });
    }
    </script>



    All the best,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 13 Jun 2012 Link to this post

    Hi Rumen,
    Thanks for reply. I wanted spell check when textbox onblur event and implemented as suggested by you.
    But i get a script error "Microsoft JScript runtime error: Object doesn't support this property or method" twice
    Once on Page load and on blur event
    Can i know how to get the"$telerik".

    I'm not able to find the
    "$telerik.$("#TextBox1").on("blur", function (e) {
            GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck();
    "

    Regards,
    Akki

    My code is below

    <body>
    <script type="text/javascript">
        function pageLoad() {debugger;
            $telerik.$("#TextBox1").on("blur", function (e) {
                GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck();
            });
        }
    </script>
        <form id="form1" runat="server">
    <asp:ScriptManager ID="mgr" runat="server"></asp:ScriptManager>
        <div>
            <telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1" ButtonType="None" />
            <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" onblur="javascript:pageLoad();"></asp:TextBox>
        </div>
        </form>
    </body>
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Jun 2012 Link to this post

    Hi Akki,

    Here is the sample code that I tried which worked as expected.
    aspx:
    <telerik:RadSpell ID="RadSpell1" runat="server" ControlsToCheck="TextBox1" ButtonType="None" />
    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" ></asp:TextBox>
    JS:
    <script type="text/javascript">
        function pageLoad() {
            $telerik.$("#TextBox1").on("blur", function   {
                GetRadSpell('<%= RadSpell1.ClientID %>').startSpellCheck();
            });
        }
    </script>

    Thanks,
    Shinu.
  6. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 14 Jun 2012 Link to this post

    Hi shinu ,
    I m not getting "$telerik" in javascript.. $telerik comes with jquery ? or do i need to do anything ?

    Regards,
    AKki
  7. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 14 Jun 2012 Link to this post

    Hello,

    Yes, jQuery is integrated in the RadControls for ASP.NET AJAX suite and you can find more information in the documentation:



     For your convenience I have attached my test project that works fine on my end.

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 15 Jun 2012 Link to this post


    Thanks very much Rumen and Shinu,
    Code you have suggested worked for me .. One Change i had to do is add Scripts tag inside script manager.
        <asp:ScriptManager ID="scrptmgr" runat="server">
        <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        </Scripts>

    One change required is .. now new pop up is opening for spell suggestions ..i want inline suggestions as attached in file named "required".

    What changes i have to do to achieve this ?

    Regards,
    Akki



  9. Answer
    Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 16 Jun 2012 Link to this post

    Hello,

    The inline suggestions shown in required.png are actually provided by the built-in browser's spellchecker which is offered by all browsers excepts Internet Explorer. Since this feature will be supported by the upcoming IE10 we do not plan to provide such functionality in RadSpell.

    If you would like you can replace the textboxes with RadEditor and use its inline spellchecker. You can configure RadEditor to looks like a textarea as shown in this demo: Displaying RadEditor as a TextBox.

    Regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017