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

Radspell for radeditors which are dynamically created on page

7 Answers 80 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Ritika
Top achievements
Rank 1
Ritika asked on 14 Oct 2012, 07:01 AM
Hi,

I have a radeditor with id="RadEditor1" on the page and a dropdown of numbers from 1-10. If i select a number from the dropdown i get those many radeditors with id= " RadEditor2" on the page(repeater is used to generate dynamically). I am using the Radspell button which should check the spellings of RadEditor1 as well as all the dynamically generated RadEditor2. How Can i do that? I want to use it for both static and dynamic controls of the page. If i assign controlstocheck property of the RadEditor as RadEditor1 and RadEditor2, and when i click Radspell button, if there are no RadEditor2 on the page,  it throws an error.

7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Oct 2012, 12:32 PM
Hi,

You should update the value of the ControlsToCheck property every time when a new RadEditor is inserted. This means that you should attach to the OnSelectedIndexChanged event of the dropdownlist control and update the value of the ControlsToCheck property in it.

Greetings,
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.
0
Ritika
Top achievements
Rank 1
answered on 16 Oct 2012, 02:27 AM
 Hi,
I have tried using like this but it doesnt spell check radeditor2. Can you please check this sample(i have just added sample code)
and let me know. should i use client id of the radeditor controls and set isclientid property to true?

 <telerik:RadEditor runat="server" ID="RadEditor1" </telerik:RadEditor>
<asp:DropDownList runat="server" ID="ddl" AutoPostBack="true"/>
  <asp:Repeater runat="server" ID="rpt"  OnItemDataBound="rptCases_DataBound">
            <ItemTemplate>
          <telerik:RadEditor runat="server" ID="RadEditor2" </telerik:RadEditor>
  </ItemTemplate>
        </asp:Repeater>

<telerik:RadSpell runat="server" ID="radspell" ControlsToCheck="RadEditor1" />
       

 this.ddl.SelectedIndexChanged += (s, a) => ProcessConsultationCases()

ProcessConsultationCases()
{
for (long i = 1; i <= ddl; i++)
               editor.Add();
this.Cases = editor;
}

void rptCases_DataBound(object source, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var description=(RadEditor)e.Item.FindControl("RadEditor2");
                this.radspell.ControlToCheck = "description";
             }
        } 

list<> Cases
        {
          set
            {
                if (value.Count > 0 && value!=null)
                {
                    this.rpt.Visible = true;
                    this.rpt.DataSource = value;
                    this.rpt.DataBind();
                }
                else
                    this.rpt.Visible = false;
            }
        }       
0
Rumen
Telerik team
answered on 18 Oct 2012, 02:41 PM
Hi,

You should fix your code because on this line you get a reference to RadEditor

var description=(RadEditor)e.Item.FindControl("RadEditor2");

and on the next one you set a string description
                this.radspell.ControlToCheck = "description";

but not

this.radspell.ControlToCheck = description.ClientID;

or

this.radspell.ControlToCheck = description.ID;

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.
0
Ritika
Top achievements
Rank 1
answered on 24 Oct 2012, 12:59 AM
Hi,

I did that..
var description=(RadEditor)e.Item.FindControl("RadEditor2");
this.radspell.ControlToCheck = "description";

 It does not spell check RadEditor2/description, it does only spellcheck for RadEditor1.

0
Rumen
Telerik team
answered on 26 Oct 2012, 01:27 PM
Hi,

Please, read my earlier post once again.

You should pass the ID of RadEditor to the ControlsToCheck property but not the string "description"; as you have set this.radspell.ControlToCheck = "description";, because you do not have such an editor with ID description on the page.

You should set

var description=(RadEditor)e.Item.FindControl("RadEditor2");
this.radspell.ControlToCheck = description.ClientID;

or

var description=(RadEditor)e.Item.FindControl("RadEditor2");
this.radspell.ControlToCheck = description.ID;

and test.

You can find an example with the ControlsToCheck property set in the codebehind in the following live demo: Overview.

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.
0
Ritika
Top achievements
Rank 1
answered on 28 Oct 2012, 10:36 PM
Hi,

I have tried using it in the below ways, it does not work still. it only spellchecks radeditor1.

<telerik:RadSpell runat="server" ID="radspell" ControlsToCheck="RadEditor1" />

var description=(RadEditor)e.Item.FindControl("RadEditor2");
this.radspell.ControlToCheck = description.ClientID;

or 

var description=(RadEditor)e.Item.FindControl("RadEditor2");
this.radspell.ControlToCheck = description.ID;


Is there any mistake again?
0
Rumen
Telerik team
answered on 31 Oct 2012, 01:11 PM
Hello,

You should do something like this on the server, once the new editor is created:

string[] elementsToCheck = {RadEditor1.ClientID, RadEditor2.ClientID};
radspell.ControlsToCheck = elementsToCheck;

If you unable to solve the issue, open a support ticket and provide a simple fully working project for examination.

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.
Tags
Spell
Asked by
Ritika
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ritika
Top achievements
Rank 1
Share this question
or