Get clientside RadGrid inside RadGrid Edit Form

3 posts, 1 answers
  1. Nick
    Nick avatar
    5 posts
    Member since:
    Jul 2016

    Posted 10 Nov 2016 Link to this post

    Hi,

    I have a RadGrid inside the EditForm of the main RadGrid:

    <telerik:RadGrid runat="server" ID="RadGrid1">
      <EditFormSettings EditFormType="Template">
        <FormTemplate>
          <div>
            <asp:Panel runat="server" ID="Panel1">
              <table><tr><td>
                <telerik:RadGrid runat="server" ID="InnerRadGrid"></telerik:RadGrid>
              </td></tr></table>
            </asp:Panel>
          </div>
        </FormTemplate>
      </EditFormSettings>
    </telerik:RadGrid>

     

    How can I reach via javascript the InnerRadGrid

    I tried using 

    RadGrid1.Controls.Add(new LiteralControl("<script type='text/javascript'>window['InnerRadGrid'] = '" + InnerRadGrid.ClientID + "';</script>"));
     var grid = document.getElementById(window['InnerRadGrid']);

     

    in RadGrid1_ItemCreated() but id doesn't work.

     

    I need it because in the header of some TemplateColumn in the InnerRadGrid I have a checkbox which, when toggled, shoul select/deselect every checkbox in that column. If there is another way to reach this functionality, it'd be fine.

     

    Thank you, regards

    Nick

  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 15 Nov 2016 Link to this post

    Hello Nick,

    You can use the $telerik.findControl(container, id) method to get reference to the RadGrid in the edit form when it is initialized:
    $telerik.findControl($find("<%=RadGrid1.ClientID%>").get_element(), "InnerRadGrid")

    Please give this a try and see if it will work in your project.


    Best Regards,
    Konstantin Dikov
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. Nick
    Nick avatar
    5 posts
    Member since:
    Jul 2016

    Posted 15 Nov 2016 in reply to Konstantin Dikov Link to this post

    That worked perfectly, thank you!

    Best regards,
    Nick

Back to Top