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

Find Grid Edit Form Template Controls using Javascript

1 Answer 497 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GP
Top achievements
Rank 1
GP asked on 18 Aug 2016, 04:21 PM

Hi, All.  I am trying to find a radeditor control that's inside a RadGrid Form Template.  I have tried so many methods, and nothing seems to be quite grabbing the item. Could someone please help me?  I need to get to the content of the editor.  This is the current path I am on:

ASP.NET

            <EditFormSettings EditFormType="Template">
                <FormTemplate>
                <div style="margin: 20px 20px 20px 20px;">
                    <h3>Accept / Reject Authorization</h3>
                    <br />
                    <span style="color: Red;">Note:</span> Provide comments to the authorizing entity then click Accept or Reject.
                    <telerik:RadEditor ID="Editor1" runat="server" OnClientLoad="OnClientLoad">
                        <Content> </Content>
                    </telerik:RadEditor><br />
                    <asp:CustomValidator ID="CV1" runat="server" ErrorMessage="Comments are required!<br />" ControlToValidate="Editor1" ForeColor="Red" Display="Dynamic" ClientValidationFunction="CheckComment"></asp:CustomValidator>
<%--                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Comments are required!<br />" ControlToValidate="Editor1" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                    <telerik:RadButton ID="AcceptAuthorization" runat="server" Text="Accept" Icon-PrimaryIconCssClass="rbOk" CommandName="Update" CommandArgument="Accept"></telerik:RadButton>      
                    <telerik:RadButton ID="RejectAuthorization" runat="server" Text="Reject" Icon-PrimaryIconCssClass="rbCancel" CommandName="Update" CommandArgument="Reject"></telerik:RadButton>      
                    <telerik:RadButton ID="CloseButton" runat="server" Text="Cancel" CommandName="Cancel" CausesValidation="False"></telerik:RadButton>
                         </div>
                </FormTemplate>
            </EditFormSettings>

Javascript:

<script type="text/javascript">
 
             function CheckComment(sender, args) {
                 alert("Hi!");
                                 
                 var ec = $telerik.findControl(container, "Editor1")
 
                      //more to come once I get past this step.           
                                args.IsValid = false;
           
                            }
 
                           </script>
  Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
GP
Top achievements
Rank 1
answered on 18 Aug 2016, 07:30 PM

Got it! 

var grid = $find('<%= AuthorizationsGrid.ClientID %>');
 var masterTableView = grid.get_masterTableView();
 var tableEl = masterTableView.get_element();
 var ec = $telerik.findControl(tableEl, "Editor1");
 
 alert(ec.get_html(true));

Tags
Grid
Asked by
GP
Top achievements
Rank 1
Answers by
GP
Top achievements
Rank 1
Share this question
or