This is a migrated thread and some comments may be shown as answers.

Multiple Text Areas Custom texts.join

3 Answers 32 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 17 Oct 2008, 01:16 AM
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?

 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/>LABEL 1<br/></controlSeparator>");  
                 }  
                 this.set_text = function(text)  
                 {  
                    var texttexts = text.split("<controlSeparator><br/><br/></controlSeparator>");  
                    for (var i = 0; i < this.sources.length; i++)  
                    {  
                       this.sources[i].set_text(texts[i]);  
                    }  
                 }  
                } 

I use
the  site.
I use the javascript

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 20 Oct 2008, 10:14 AM
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.
0
Victor
Top achievements
Rank 1
answered on 20 Oct 2008, 05:08 PM
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?


0
George
Telerik team
answered on 21 Oct 2008, 08:46 AM
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.
Tags
Spell
Asked by
Victor
Top achievements
Rank 1
Answers by
George
Telerik team
Victor
Top achievements
Rank 1
Share this question
or