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

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

    Posted 20 Jul 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.
    function

    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

    http://stackoverflow.com/questions/38481200/finding-the-client-id-for-a-radgrid-inside-a-radlightboxitem-tag-in-a-radlightbo

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 25 Jul Link to this post

    Hello,

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

    Regards,
    Kostadin
    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top