Grid with radwindow after second bind cannot be found

2 posts, 0 answers
  1. Peter
    Peter avatar
    12 posts
    Member since:
    Nov 2008

    Posted 27 May 2012 Link to this post

    Hi,
    I have a radgrid with edit links to open radwindow to update a record.
    It is a modified copy of your code Edit dialog for RadGrid
    The differences are:
    My Rad Grid is on UserControl
    I'm using LinqDataSource for selecting record.

    On the "Update", call is made to refreshGrid function call ajaxRequest to rebind the grid.

    This works the first time, the second time I cannot open the RadWindow.
    The error is "grid is null" in the following function

            function ShowEditForm(id, rowIndex) {
                var grid = $find("<%= RadGrid1.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);

                window.radopen("../FileStorage/Pages/ClientMnt.aspx?ClientId=" + id, "ClientMntDialog");
                return false;
            }


    Anyone any ideas?

    Thanks
    Peter
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5701 posts

    Posted 30 May 2012 Link to this post

    Hi Peter,

    Do you change the ID of your RadGrid in the server or in case it is created dynamically can you confirm that it has the same ID each time? Is the function in the same user control? Is the user control added via AJAX or not? I am asking all these questions, because there are limitations in the MS AJAX framework when JavaScript code inside a user control is loaded dynamically and if it is not recreated properly.

    This error is not related to the RadWindow, but to the way you reference the RadGrid and a JavaScript error breaks the execution of the sctipt which is why your RadWindow does not open.

    If you cannot trace where the change of IDs occurs I advise that you open a support ticket and send us a simple, runnable page that shows the problem. I do not believe the actual database and datasource will be necessary, as  they are not relevant to the way the controls are accessed and created. The steps from this blog post can be helpful in isolating the sample.


    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top