Multiple Text Areas Custom texts.join

4 posts, 0 answers
  1. Victor
    Victor avatar
    11 posts
    Member since:
    Oct 2008

    Posted 16 Oct 2008 Link to this post

    Hi I have 12 Textarea Controls which I spell check using the RAD spell control.

    I use the  MultipleTextSource(sources) function provided on the documentation section. http://www.telerik.com/help/aspnet-ajax/spell_howtomutlipletextareas.html

    Everything works great but I was wondering if there is a way to use a distinct controlSeperator for each Text Area so I can put labels in the spell checker window.

    Is this possible?

    1  function MultipleTextSource(sources) {  
    2                  this.sources = sources;  
    3                  this.get_text = function()  
    4                  {  
    5                     var texts = [];  
    6                     for (var i = 0; i < this.sources.length; i++)  
    7                     {  
    8                        texts[texts.length] = this.sources[i].get_text();  
    9                     }  
    10                     return texts.join("<controlSeparator><br/>LABEL 1<br/></controlSeparator>");  
    11                  }  
    12                  this.set_text = function(text)  
    13                  {  
    14                     var texttexts = text.split("<controlSeparator><br/><br/></controlSeparator>");  
    15                     for (var i = 0; i < this.sources.length; i++)  
    16                     {  
    17                        this.sources[i].set_text(texts[i]);  
    18                     }  
    19                  }  
    20                 } 

    I use
    the  site.
    I use the javascript
  2. George
    Admin
    George avatar
    859 posts

    Posted 20 Oct 2008 Link to this post

    Hi Victor,

    Yes you can customize the control separator. Please review bellow how to achieve this.
    <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/><span style=\"background-color:green;\">*********************</span><br/></controlSeparator>");  
         }  
         this.set_text = function(text)  
         {  
            var texts = text.split("<controlSeparator><br/><span style=\"background-color:green;\">*********************</span><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('TextBox1')),  
               new Telerik.Web.UI.Spell.HtmlElementTextSource($get('TextBox2')),  
               new Telerik.Web.UI.Spell.HtmlElementTextSource($get('TextBox3'))  
               ];  
           var spell = $find('<%= RadSpell1.ClientID %>');  
           spell.set_textSource(new MultipleTextSource(sources));  
           spell.startSpellCheck();  
       }  
    </script>  
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>  
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>  
    <telerik:RadSpell ID="RadSpell1" runat="server" ButtonType="None" />  
    <input id="Button1" type="button" value="Spell Check All" onclick="spellCheck();" /> 

    I hope this helps.

    Regards,
    George
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Victor
    Victor avatar
    11 posts
    Member since:
    Oct 2008

    Posted 20 Oct 2008 Link to this post

    Hi I want a custom Separator for each TextBox. So each text box will have a Label in the spell check window. What your code does is create one custom Separator for all the TextBoxes.

    Can this be accomplished?


  5. George
    Admin
    George avatar
    859 posts

    Posted 21 Oct 2008 Link to this post

    Hi Victor,

    Unfortunately, currently the desired functionality is not supported out of the box.

    Best regards,
    George
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top