Get_MasterTableView() Is NULL

3 posts, 1 answers
  1. Sean
    Sean avatar
    19 posts
    Member since:
    Jun 2012

    Posted 06 Dec 2013 Link to this post


    I have seen this issue reported by other people, but I have never had an issue. Now, it seems, I do. I've tried just about everything I know to resolve it, but while I find the gird on the page, the method get_masterTableView() always returns null.

    My scenario involves my wanting to asynchronously load many grids on a page. Loading them normally has been pretty slow, so I am looking at faster ways to get the page up. As grid data populates, the grid shows up. Here is one of my Grid definitions:

    <telerik:RadGrid ID="MyAnimalCategories" runat="server" AllowPaging="True" AllowSorting="True"
                       AutoGenerateColumns="False" AutoGenerateEditColumn="False" CellSpacing="0" GridLines="None"
                       OnNeedDataSource="MyAnimalCategoriesNeedDataSource" PageSize="20" OnSelectedIndexChanged="MyAnimalCategoriesSelectedIndexChanged">
                        <ClientSettings EnablePostBackOnRowClick="true">                                   
                           <Selecting AllowRowSelect="true" />
                           <ClientEvents OnRowSelected="SetDeviceText" OnCommand="function(){}" />
                       <MasterTableView ShowHeadersWhenNoRecords="true" ClientDataKeyNames="AnimalCategoryId" DataKeyNames="AnimalCategoryId"  TableLayout="Fixed">
                               <telerik:GridBoundColumn DataField="AnimalCategoryName" HeaderText="Animal Species" UniqueName="Category">
                                   <ItemStyle Wrap="false" />
                                   <HeaderStyle Wrap="false" />
                               <telerik:GridTemplateColumn ItemStyle-Width="50px" AllowFiltering="false" ReadOnly="true"
                                       <%# Convert.ToBoolean(Eval("IsActive").ToString())? "Active":"Inactive" %>

    Here is the script
    <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
            <script type="text/javascript">
                function pageLoad(src, args) {
                    var trainer = $('#<%= hdnTrainer.ClientID %>');
                    var trainerId = trainer.val();
                    PageMethod("LoadMySpecies", ["trainerId", trainerId], MySpecies, AjaxFailed);
                    PageMethod("LoadMySubmissions", [], MySubmissions, AjaxFailed);
                function PageMethod(fn, paramArray, successFn, errorFn) {
                    var pagePath = window.location.pathname;
                    //Create list of parameters in the form : {"paramName1":"paramValue1","paramName2":"paramValue2"}
                    var paramList = '';
                    if (paramArray.length > 0) {
                        for (var i = 0; i < paramArray.length; i += 2) {
                            if (paramList.length > 0)
                                paramList += ',';
                            paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
                    paramList = '{' + paramList + '}';
                    //Call the page method
                        type: "POST",
                        url: pagePath + "/" + fn,
                        contentType: "application/json; charset=utf-8",
                        data: paramList,
                        dataType: "json",
                        success: successFn,
                        error: errorFn
                function MySubmissions(result) {
                    var grid =  $find("<%= MySubmissions.ClientID %>");
                    var masterTable = grid.get_masterTableView();
                    var data = eval(result.d);
                function MySpecies(result) {
                    var grid = $find('<%= MyAnimalCategories.ClientID %>');
                    var masterTable = grid.get_masterTableView();
                    var data = eval(result.d);
                function AjaxFailed(result) {

    The script, as I said, finds the grid just fine, but the methods in the object do not include the get_masterTableView().

    Thanks for any insight!


  2. Answer
    Kostadin avatar
    1733 posts

    Posted 11 Dec 2013 Link to this post

    Hi Sean,

    Thank you for contacting us.

    A possible reason for the get_masterTableView() method to return null is if you are trying to access the MasterTableView before it is created. I noticed that you are trying to access the master table view on page load where the master table view might still not be created. I would recommend you to fire the PageMethod on GridCreated event handler. More information about GridCreated event is available in this help article:

    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 the blog feed now.
  3. Robin
    Robin avatar
    7 posts
    Member since:
    Sep 2014

    Posted 11 Dec 2014 in reply to Kostadin Link to this post

    I found this article useful in the case where I was creating a grid without giving it a datasource. Giving the grid a bogus datasource at first created the grid and raised the created event where I actually get the data.

    Maybe it can be useful to someone else!
Back to Top