This is a migrated thread and some comments may be shown as answers.

Page Error-this._owner.get_masterTableView() is null or not a object

4 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fou Weiqiang
Top achievements
Rank 1
Fou Weiqiang asked on 18 May 2010, 03:01 AM
when I use RadGrid in asp.net page, it popup an error occasionally(Please see attachment)
Please give me some suggestion to void it.   thank you very much.













4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 19 May 2010, 12:10 PM
Hi Fou,

Could you please elaborate a bit more on your scenario. When do you receive the described error? A possible reason for the get_masterTableView() method to return null is if you are trying to access the MasterTableView before it is created. If it is called after the GridCreated client-side event, it should always return the respective MasterTableView client object. However it is hard to say what is causing this problem without seeing some code. Could you please post your aspx page which contains the RadGrid declaration within the code behind or open a support ticket and send us a small runnable project which demonstrates the issue.  In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Kind regards,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Fou Weiqiang
Top achievements
Rank 1
answered on 20 May 2010, 04:14 AM
      Thank you! I know the common reason after you reply,  But  this problem occur occasionally. not always occur. . Following is Aspx and Javascript Code snip.
      Please See Bold charachter in the code snip, it is server side code in the aspx file,  does it a hidden trouble because it it fired before .MasterTableView created!

Aspx Code
    <div class="search_middle_btn">

                <asp:Button ID="btnAdd" runat="server" class="btn_small_addkehu" ToolTip="新增客户" onfocus="this.blur()"
                        OnClientClick="return ShowInsertForm();" />
                    <asp:Button ID="btnEdit" runat="server" class="btn_small_edit" ToolTip="修改客户" onfocus="this.blur()"
                        OnClientClick="return ShowEditForm();" />
                    <asp:Button ID="btnSaleMan" runat="server" class="btn_small_xiaoshou" ToolTip="指派销售人员"
                        onfocus="this.blur()" OnClientClick="return ShowShareForm();" />
                    <asp:Button ID="btnManager" runat="server" onfocus="this.blur()" ToolTip="指派管理人员"
                        CssClass="btn_small_guanli" OnClientClick="return ShowManagerForm();" />
                    <asp:Button ID="btnDel" runat="server" class="btn_small_del" ToolTip="删除客户" onfocus="this.blur()"
                        OnClientClick="onDelClick();return false;" />
           
    </div>
    <telerik:RadGrid ID="RadGridCustomer" runat="server" AllowMultiRowSelection="true"
                MasterTableView-ShowHeadersWhenNoRecords="true" Skin="Hay" HeaderStyle-HorizontalAlign="Center"
                AllowSorting="true" SortingSettings-SortToolTip="点击排序" OnSortCommand="RadGridCustomer_SortCommand"
                OnDataBound="RadGridCustomer_DataBound" OnItemDataBound="RadGridCustomer_ItemDataBound">
                <MasterTableView AutoGenerateColumns="False" AllowNaturalSort="false" DataKeyNames="CustomerID,CussState,CusName,CusPhase,CusCode"
                    ClientDataKeyNames="CustomerID,CussState,CusName,CusPhase" NoMasterRecordsText="没有符合条件的记录。"
                    CommandItemDisplay="None">
                    <Columns>
                        <telerik:GridClientSelectColumn UniqueName="Row" HeaderStyle-Width="30" ItemStyle-HorizontalAlign="Center" />
                        <telerik:GridBoundColumn DataField="DistrictName" HeaderText="行政区域" ReadOnly="true"
                            HeaderStyle-Width="120" />
                        <telerik:GridTemplateColumn HeaderText="客户编号" SortExpression="CusCode" UniqueName="CusCode"
                            HeaderStyle-Width="80">
                            <ItemTemplate>
                                <asp:Literal ID="lblCustomerID" runat="server" Text='<%#Eval("CustomerID") %>' Visible="false"></asp:Literal>
                                <asp:Literal ID="lblCustomerCode" runat="server" Text='<%#Eval("CusCode") %>'></asp:Literal>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="CusName" HeaderText="客户名称" ReadOnly="true" HeaderStyle-Width="150"
                            SortExpression="CusName" UniqueName="CusName" />
                        <telerik:GridBoundColumn DataField="LinkmanName" HeaderText="主联系人" ReadOnly="true"
                            HeaderStyle-Width="120" SortExpression="LinkmanName" UniqueName="LinkmanName" />
                        <telerik:GridBoundColumn DataField="LinkmanMobile" HeaderText="手机" ReadOnly="true"
                            HeaderStyle-Width="120" SortExpression="LinkmanMobile" UniqueName="LinkmanMobile" />
                        <telerik:GridBoundColumn DataField="CusPhaseName" HeaderText="客户阶段" ReadOnly="true"
                            HeaderStyle-Width="120" SortExpression="CusPhase" UniqueName="CusPhase" />
                        <telerik:GridTemplateColumn HeaderText="销售人员" HeaderStyle-Width="120">
                            <ItemTemplate>
                                <asp:Literal ID="lblSaleMan" runat="server" Text='<%# GetCustomerSalesMan(Convert.ToInt32(Eval("CustomerID"))) %>'></asp:Literal>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="操作" HeaderStyle-Width="120" UniqueName="Claimant">
                            <ItemTemplate>
                                <input id="HidIsPublic" type="hidden" runat="server" value='<%#Eval("CusIsPublic") %>' />
                                <input id="HidCustomerID" type="hidden" runat="server" value='<%#Eval("CustomerID") %>' />
                                <input id="btnClaimant" type="button" class="btn_radgrid_shenling" runat="server" />
                                <input id="btnPublic" type="button" runat="server" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Selecting AllowRowSelect="true" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="220" />
                    <ClientEvents OnRowSelected="GridRowClick" OnRowDeselected="GridRowClickUnSelected" />
                </ClientSettings>
            </telerik:RadGrid>
Javascript:
            function ShowManagerForm() {

            var id = '';
            var grid = $find("<%= RadGridCustomer.MasterTableView.ClientID %>");
           ---------------------------------
        }
        //指派
        function ShowSendForm() {
            var id = '';
            var grid = $find("<%= RadGridCustomer.MasterTableView.ClientID %>");
            var selectedCount = grid.get_selectedItems();

          -------------------
            return false;
        }

0
Fou Weiqiang
Top achievements
Rank 1
answered on 25 May 2010, 03:25 AM
Thank you! I know the common reason after you reply,  But  this problem occur occasionally. not always occur. . Following is Aspx and Javascript Code snip.
      Please See Bold charachter in the code snip, it is server side code in the aspx file,  does it a hidden trouble because it it fired before .MasterTableView created!
0
Radoslav
Telerik team
answered on 25 May 2010, 12:15 PM
Hi Fou,

I have examined the code you have sent us and it looks correct. Also I tried to reproduce the issue locally but to no avail. Could you please send us a simple running project demonstrating the problem.  You could open a formal support ticket from your Telerik account and attach a ZIP file there . In that way we can reproduce and pinpoint the problems you're facing on our side and provide a solution.

Additionally if you call the ShowManagerForm() function before the MasterTableView created, the error will be " 'null' is null or not an object".

All the best,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Fou Weiqiang
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Fou Weiqiang
Top achievements
Rank 1
Share this question
or