Finding the Client ID for a RadGrid inside a RadLightBoxItem tag in a RadLightBox

3 posts, 0 answers
  1. Ben
    Ben avatar
    6 posts
    Member since:
    Jul 2016

    Posted 20 Jul 2016 Link to this post

    I'm trying to fetch the ClientID for a RadGrid control from client side using JavaScript so that I'll be able to bind data to this from the client side.
    The RadGrid is present within the RadLightBox and needs to be populated on a button click event. The markup for LightBox looks something like this.
    <telerik:RadLightBox ID="RadLightBox1" runat="server">

    <Items><telerik:RadLightBoxItemrunat="server"><ItemTemplate><telerik:RadGrid runat="server" ID="lightbox_radgrid"AutoGenerateColumns="false"><MasterTableView><Columns><%-- Columns not shown here --%> </Columns></MasterTableView><ClientSettings><ClientEvents OnCommand="window_radgrid_OnCommand"/></ClientSettings><GroupingSettings CaseSensitive="false" ShowUnGroupButton="true" /></telerik:RadGrid></ItemTemplate></telerik:RadLightBoxItem></Items></telerik:RadLightBox>

    This is the partial Javascript Code that I have written. I am able to find upto the RadLIghtBoxItem element but unable to fetch the RadGrid and it's clientID. This method is to be executed on success of a call to a web service to return the data.

    onSucessCallThis(result, userContext, methodName)


     var radWindow = $find('<%= lightbox.ClientID %>');var LightBoxItems = radWindow.get_items(); console.log(LightBoxItems); console.log(LightBoxItems.get_count());var item = LightBoxItems.getItem(0); console.log(item); //Able to fetch LightBoxItemvar radGrid = item.FindControl("lightbox_radgrid"); //Doesn't work


    I'm not sure if this is the right way to have a radGrid inside a radLightBox. There isn't many examples of this online.

    If the code is unreadable here please check this stackoverflow question

  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 25 Jul 2016 Link to this post


    A possible solution to access the grid on the client is to hook OnShowed client event of RadLightBox and use the findControl of Telerik Static Client Library.
    Please check out the following code snippet.
    function OnShowed(sender, args)
        var grid = $telerik.findControl(sender.get_element(), "lightbox_radgrid");

    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Frank
    Frank avatar
    22 posts
    Member since:
    Jun 2017

    Posted 18 Jan 2018 in reply to Kostadin Link to this post

    Just FYI, I tried your OnShowed event on the lightbox (which I don't even see on the property tool box), it doesn't do anything.  


    <telerik:radlightbox id="LBoxEdit" runat="server" width="500px" height="200px" OnShowed="OnShowed"
            modal="true" ShowMaximizeButton="False" ShowRestoreButton="False" RenderMode="Lightweight">




            function OnShowed(sender, args) {



    I don't even see the message box thus make me think the "onshow" event doesn't even exist.

Back to Top