Tech Junkie Blog - Real World Tutorials, Happy Coding!: Telerik: Why the $find Method is Not Working for RadGrid

Thursday, September 19, 2013

Telerik: Why the $find Method is Not Working for RadGrid

The reason the $find method is not working for you is because the RadGrid loads on late binding. You need to get the RadGrid client object in the pageLoad() function like in the code below. After you get it you can set the global variables in the your Javascript so the other function will have access to the RadGrid object.

    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script type="text/javascript">
            var radGrid = null;
            var masterTableView = null;
            var rgDataItems = null;



            function pageLoad() {
                radGrid = $find("<%= RadGrid1.ClientID %>");
                masterTableView = grid.get_masterTableView();
                rgDataItems = masterTable.get_dataItems();
             }
        </script>
    </telerik:RadCodeBlock>

1 comment:

Search This Blog