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

Dynamic control of ControlsToCheck

1 Answer 64 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 03 Jan 2011, 11:36 PM
Hello,

I'm trying to dynamically control the ControlsToCheck property to spell check multiple text boxes on a page contained in a multipage with pageview.  I want to spell check certain fields at certain times and I need the ability to chcek only those controls that area active - these are dynamically controled by my users. In the example below I have 10 user Text Boxes in 10 panels, any of which can be active (Visible) or inactive (not visible) at any time based on some user controls on another page. I control the text boxes using panels so I can hide and show titles and the text boxes with one line of code. Thanks in advance, Dan

 

<table width="750" align="center">
                             <tr>
                                 <td align="center">
                                     <asp:Panel ID="PanelUserField10" Runat="server" visible="false">
                                         <p />
                                         <asp:Label ID="LabelUserField10" Runat="server" CssClass="APR_INFO_TEXT"></asp:Label>
                                         <asp:Panel ID="PanelUserFieldText10" Runat="server">
                                             <br />
                                             <asp:TextBox id="TextUserField10" runat="server" TextMode="MultiLine" CssClass="APR_COMMENT_TEXT" Wrap="true" Rows= "10" Columns = "150"></asp:TextBox>
                                         </asp:Panel>
                                     </asp:Panel>
                                 </td>
                             </tr>
                         </table>
                         <br />
                 </asp:Panel>
                 <DIV style="MARGIN-RIGHT: 20px" align="center">
                                                 <telerik:RadSpell ID="RadSpell2" Runat="server" 
                                                     ControlsToCheck="TextUserField1" 
                                                     SupportedLanguages="en-US,English" 
                                                         DictionaryPath="~/Common/RadSpell" 
                                                     ButtonText="Click here for Spell Check" 
                                                     ToolTip="Click here to check Spelling." Skin="Telerik" />
                                                  </DIV>
             </iewc:PageView>
             <iewc:PageView>
                 <asp:Label ID="LabelGeneralActivities_NotYetSubmitted" Runat="server">
                     <br>
                     <br>

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Jan 2011, 11:15 AM
Hello Dan,

You can populate the ControlsToCheck array on the server, after you have set the visibility of the controls - for example in the PreRender event of the page. Here is some sample code:
Copy Code
List<string> controls = new List<string>();
if (RadEditor1.Visible) controls.Add(RadEditor1.ID);
if (textbox1.Visible) controls.Add(textbox1.ID);
//....more controls here if needed
RadSpell1.ControlsToCheck = controls.ToArray();

This information is available in the following forum thread: Spell Check Multiple Controls on Submit.

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