Put RadSpell inside a RadGrid

5 posts, 0 answers
  1. tom
    tom avatar
    8 posts
    Member since:
    May 2008

    Posted 10 Jul 2008 Link to this post

    I want to use RadSpell inside of my RadGrid.  When in "edit mode" I want it to spell check a GridBoundColumn.

    Is there an example of that anywhere?
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 11 Jul 2008 Link to this post

    Hi Tom,

    Please, review the following live example which could be helpful for your scenario: Spellchecking Datagrid Controls.

    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hossein
    Hossein avatar
    6 posts
    Member since:
    Jan 2012

    Posted 11 Apr 2013 Link to this post

    Hi Rumen,
    I have an small different case than this . I used the sample that you refer Tom to. In My case my grid rows are all in Edit mode (inline edit) and I have one column that has RadText. I used DataBound to find ClientID of all textboxes in different row to attached them to RadSpell. It load spellcheck and everything works but when it try to close RadSpell it gives me this error. My assumption is that it couldn't put the corrected text back to textboxes in rows. here is my code.
    Any help would be appreciated
    Hossein

    <telerik:RadGrid ID="RadGridBillTemplateLines" GridLines="None"
               runat="server" Width="100%" CellSpacing="0"
               AutoGenerateColumns="False" AllowMultiRowEdit="True"
               OnPreRender="RadGridBillTemplateLines_PreRender"
               OnDeleteCommand="RadGridBillTemplateLines_DeleteCommand"
               OnUpdateCommand="RadGridBillTemplateLines_UpdateCommand"
               OnItemCreated="RadGridBillTemplateLines_ItemCreated" Height="280px" DataSourceID="odsBillTemplateline"
               OnDataBound="RadGridBillTemplateLines_DataBound">
               <FilterMenu EnableImageSprites="False" />
               <ClientSettings>
                   <Scrolling AllowScroll="True" UseStaticHeaders="True" />
               </ClientSettings>
               <MasterTableView CommandItemDisplay="Top" EditMode="InPlace" DataKeyNames="ID" ShowFooter="true" DataSourceID="odsBillTemplateline">
                   <CommandItemSettings ExportToPdfText="Export to PDF" />
                   <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True" />
                   <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True" />
                   <Columns>
                       <telerik:GridTemplateColumn FilterControlAltText="Filter BillDescription column" UniqueName="BillDescription" HeaderText="Bill Description">
                           <EditItemTemplate>
                               <telerik:RadTextBox ID="BillDescriptionTextBox" runat="server" Width="100%" Text='<%# Bind("BillDescription") %>' MaxLength="100"></telerik:RadTextBox>
                           </EditItemTemplate>
                           <ItemTemplate>
                               <telerik:RadTextBox ID="BillDescriptionTextBox" runat="server" Width="100%" Text='<%# Bind("BillDescription") %>' MaxLength="100"></telerik:RadTextBox>
                           </ItemTemplate>
                           <HeaderStyle Width="75%" />
                           <ItemStyle Width="75%" />
                       </telerik:GridTemplateColumn>
                       <telerik:GridCheckBoxColumn DataField="HasAmount" DataType="System.Boolean" FilterControlAltText="Filter HasAmount column"
                           HeaderText="Has Amount" SortExpression="HasAmount" UniqueName="HasAmount">
                       </telerik:GridCheckBoxColumn>
                       <telerik:GridCheckBoxColumn DataField="ExcludeRealization" DataType="System.Boolean" FilterControlAltText="Filter ExcludeRealization column"
                           HeaderText="Exclude Realization" SortExpression="ExcludeRealization" UniqueName="ExcludeRealization">
                       </telerik:GridCheckBoxColumn>
                       <telerik:GridTemplateColumn
                           Groupable="False" UniqueName="EditCommandColumn">
                           <FooterTemplate>
                               <telerik:RadButton Width="80px" runat="server" ID="SaveAllRadButton" ButtonType="LinkButton" BackColor="#efefef"
                                   CommandName="UpdateEdited" ToolTip="Save All Records" Text="" BorderStyle="None">
                                   <Icon PrimaryIconUrl="~/images/Save_16x16.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                               </telerik:RadButton>
                           </FooterTemplate>
                           <ItemTemplate>
                               <telerik:RadButton runat="server" ID="DeleteRadButton" ButtonType="LinkButton" ToolTip="Delete BillTemplateLine"
                                   BorderStyle="None" CommandName="Delete" OnClientClicked="OnClientDelete"
                                   Visible="true">
                                   <Icon PrimaryIconUrl="~/images/delete.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                               </telerik:RadButton>
                           </ItemTemplate>
                           <EditItemTemplate>
                               <telerik:RadButton runat="server" ID="DeleteRadButton" ButtonType="LinkButton" ToolTip="Delete BillTemplateLine"
                                   BorderStyle="None" CommandName="Delete" OnClientClicked="OnClientDelete"
                                   Visible="true">
                                   <Icon PrimaryIconUrl="~/images/delete.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                               </telerik:RadButton>
                           </EditItemTemplate>
                           <HeaderStyle Width="5%" />
                           <ItemStyle Width="5%" HorizontalAlign="Right" VerticalAlign="Top" />
                       </telerik:GridTemplateColumn>
                   </Columns>
                   <EditFormSettings>
                       <EditColumn FilterControlAltText="Filter EditCommandColumn column" />
                   </EditFormSettings>
     
                   <CommandItemTemplate>
                       <table border="0" style="width: 100%" class="rgCommandTable">
                           <tr>
                               <td align="left">
                                   <telerik:RadButton runat="server" ID="AddRadButton" ButtonType="LinkButton" ToolTip="Add New BillTemplateLine"
                                       Visible="true" AutoPostBack="true"
                                       Text="Add Bill Template Line" BackColor="#dedbde" BorderStyle="Solid" OnClick="AddRadButton_Click">
                                       <Icon PrimaryIconUrl="~/images/add_16x16.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                                   </telerik:RadButton>
                                   <telerik:RadButton Width="80px" runat="server" ID="SaveAllRadButton" ButtonType="LinkButton" BackColor="#dedbde"
                                       CommandName="UpdateEdited" ToolTip="Save All Records" Text="Save All" BorderStyle="Solid">
                                       <Icon PrimaryIconUrl="~/images/Save_16x16.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                                   </telerik:RadButton>
                                   <telerik:RadButton Width="80px" runat="server" ID="SpellCheckRadButton" ButtonType="LinkButton" BackColor="#dedbde"
                                       OnClientClicked="StartCheck" ToolTip="Spell Check" Text="Spell Check" BorderStyle="Solid">
                                       <Icon PrimaryIconUrl="~/images/Save_16x16.png" PrimaryIconHeight="16" PrimaryIconWidth="16" />
                                   </telerik:RadButton>
                               </td>
                               <td align="right">
                                   <asp:Button CommandName="RebindGrid" runat="server" ID="btnRefresh" Text=" " title="Refresh"
                                       CssClass="rgRefresh" Visible="true" />
                                   <asp:LinkButton ID="lnkbRefresh" CommandName="RebindGrid" runat="server" Visible="true">Refresh</asp:LinkButton>
                               </td>
                           </tr>
                       </table>
                   </CommandItemTemplate>
               </MasterTableView>
           </telerik:RadGrid>

    Code Behind 

    protected void RadGridBillTemplateLines_DataBound(object sender, EventArgs e)
           {
     
               int index = 0;
               Stack controlsToCheck = new Stack();
               foreach (GridDataItem item in RadGridBillTemplateLines.Items)
               {
                   if (item is GridEditableItem)
                   {
                       GridDataItem descriptionITem = (GridDataItem)item;
                       RadTextBox radDescription = (RadTextBox)descriptionITem["BillDescription"].Controls[1];
                       controlsToCheck.Push(radDescription.ClientID);
                       index++;
                   }
               }
     
               RadSpell1.ControlsToCheck = new string[index];
               while (controlsToCheck.Count > 0)
               {
                   RadSpell1.ControlsToCheck.SetValue(controlsToCheck.Pop(), controlsToCheck.Count);
               }
               RadSpell1.IsClientID = true;
     
           }

    When I  connect RadSpell to a textbox outside of grid everyting works fine (as test)

    here is Javascript error I get 

    Unhandled exception at line 9203, column 1 in http://localhost:49696/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2012.3.1205.40,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:f18b91a4-0e6c-41d1-af11-dfb338738b79:16e4e7cd:ed16cbdc:f7645509:cb4a7569:24ee1bba:30f1f089:874f8ea2:19620875:f46195d3:490a9d4e:2003d0b8:1e771326:aa288e2d:b7778d6c:58366029:7165f74:2bef5fcc
     
    0x80004005 - Microsoft JScript runtime error: Unspecified error.


       
  5. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 16 Apr 2013 Link to this post

    Hi Hossein,

    I tried to reproduce the problem you described, but to no avail. You can find attached the test sample that I prepared according to your information. Please compare it with your actual project and check if there is a difference in the setup.

    Since the RadSpell uses HTTP handlers similarly to the RadEditor (Telerik.Web.UI.SpellCheckHandler.axd and Telerik.Web.UI.DialogHandler.axd), you can check if the scenario that is described in this help article is valid in your case.

    Note that at the current state of affairs I am mostly guessing as to what your setup is. If you are still experiencing difficulties please try modifying the attached sample in order to recreate the problem. In case this is not possible, you can send a sample, runnable project that displays your issue so that we can examine it locally and provide a more to the point answer.

    All the best,
    Slav
    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.
  6. Hossein
    Hossein avatar
    6 posts
    Member since:
    Jan 2012

    Posted 16 Apr 2013 Link to this post

    Hi Slav,
    Thanks for reply, I just found the issue. For what it worth, I thought I tell you how I resolved it as someone else may have the same issue.

    The problem was "Post back". The Button that start the spell checker (for the whole gird) should have "AutoPostBack= false" (since it call spell checker start from client side) to not postback otherwise it cause the javascript error.

    Regards
    Hossein
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017