Spell Check not changing text after spell complete?

4 posts, 0 answers
  1. Adam
    Adam avatar
    12 posts
    Member since:
    Apr 2011

    Posted 02 May 2011 Link to this post

    In both IE and FF...I have 3 text boxes, all 3 with misspelled words. I am using a button to trigger the spell check...the spell check dialog pops up and suggests correct words...I hit 'change'...then it says 'The Spell Check is complete!'...when I click 'OK' the text in the textboxes has not changed. While the code shows the textboxes as enabled=false, they are enabled=true at the time of spellcheck.

    <script type="text/javascript">
            function spellCheck() {
                var spell = $find('<%= splContractSpellCheck.ClientID %>');
                spell.startSpellCheck();
            }
    </script>
      
    <asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck()" />
      
    <telerik:RadSpell ID="splContractSpellCheck" runat="server" ControlsToCheck="txtContractSummary,txtContractPurpose,txtContractComments"                                 ButtonType="None" />
      
    <asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" />
    <asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" />
    <asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />
  2. Adam
    Adam avatar
    12 posts
    Member since:
    Apr 2011

    Posted 03 May 2011 Link to this post

    As a follow up, I've also tried a different approach, based on some of what I've seen...it too, doesn't update the text...despite the fact I've verified that set_text is being called and is being passed the correct word.

        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function MultipleTextSource(sources) {
                    this.sources = sources;
                    this.get_text = function () {
                        var texts = [];
                        for (var i = 0; i < this.sources.length; i++) {
                            texts[texts.length] = this.sources[i].get_text();
                        }
                        return texts.join("<controlSeparator><br/></controlSeparator>");
                    }
                    this.set_text = function (text) {
                    alert(text)
                        var texts = text.split("<controlSeparator><br/></controlSeparator>");
                        for (var i = 0; i < this.sources.length; i++) {
                            this.sources[i].set_text(texts[i]);
                        }
                    }
                }
      
                function spellCheck() {
                    var sources =
                        [
                            new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractSummary.ClientID %>')),
                            new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractPurpose.ClientID %>')),
                            new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractComments.ClientID %>'))
                        ];
                      
                    var spell = $find('<%= splContractSpellCheck.ClientID %>');
                    spell.set_textSource(new MultipleTextSource(sources));
                    spell.startSpellCheck();
                }
            </script>
        </telerik:RadCodeBlock>
      
    <asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck();" />
      
    <telerik:RadSpell ID="splContractSpellCheck" runat="server" ButtonType="None" />
      
    <asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" />
    <asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" />
    <asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 05 May 2011 Link to this post

    Hi Adam,

    All you need to do is to put "return false;" in the OnClientClick event of the Asp:Button, e.g.

    <asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck();return false;" />


    Here is a video demonstrating the solution: http://screencast.com/t/oz4YNTAY1VJ.

    Best regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Adam
    Adam avatar
    12 posts
    Member since:
    Apr 2011

    Posted 06 May 2011 Link to this post

    awesome, that worked. Thanks!
Back to Top