Find Grid Edit Form Template Controls using Javascript

2 posts, 0 answers
  1. GP
    GP avatar
    58 posts
    Member since:
    Oct 2009

    Posted 18 Aug Link to this post

    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!

  2. GP
    GP avatar
    58 posts
    Member since:
    Oct 2009

    Posted 18 Aug Link to this post

    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));

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