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

get_masterTableView() Throwing Error

17 Answers 764 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Online .Net Developers
Top achievements
Rank 1
Online .Net Developers asked on 17 Dec 2008, 12:44 AM
I'm trying to get my first RadGrid to be populated on the Client side using a call to a WebMethod.  That part works, but when I try to call get_masterTableView(), I get a JavaScript error that "id" cannot be null.

I'm probably missing something obvious, but here is my code:

There is data in the result object.
       function updateGrid(result) 
       { 
          var gridObject = $find("<%=AGPermissions.ClientID %>"); 
          var tableView = gridObject.get_masterTableView(); 
          tableView.set_dataSource(result); 
          tableView.dataBind(); 
       } 

This thread indicated that an empty OnCommand event function would fix this issue, but it did not.
    <telerik:RadGrid ID="AGPermissions" EnableViewState="false" Skin="Sunset" runat="server" 
        AllowPaging="true" AllowSorting="True" AllowFilteringByColumn="true" GridLines="None"
        <ItemStyle Wrap="false" /> 
        <MasterTableView AllowMultiColumnSorting="true" TableLayout="Fixed"
            <Columns> 
                    <telerik:GridBoundColumn DataField="AssetGroupID" HeaderText="Asset Group ID" /> 
                    <telerik:GridBoundColumn DataField="MembershipID" HeaderText="Asset Group ID" /> 
                    <telerik:GridBoundColumn DataField="AssetGroupName" HeaderText="Asset Group Name" /> 
                    <telerik:GridBoundColumn DataField="AssetGroupPermissionTypeID" HeaderText="Asset Group Permission Type" /> 
                    <telerik:GridBoundColumn DataField="AssetGroupPermissionType" HeaderText="Asset Group Permission Type" /> 
            </Columns> 
        </MasterTableView> 
        <PagerStyle AlwaysVisible="true" /> 
        <ClientSettings> 
            <ClientEvents OnCommand="function(){}" /> 
        </ClientSettings>                                     
    </telerik:RadGrid> 

I attached to IE and this is what the error looks like: http://37web.com/radgriderror.jpg

Misc:

(*) I have an asp:ScriptManager with EnablePageMethods="true" in my MasterPage.
(*) I have cleared out IE's cache, deleted my Temporary ASP.NET Files, and recompiled, all to no effect.
(*) I'm using Visual Studio 2008, IE 7, and Windows XP.

Any help you could provide a new customer would be greatly appreciated.

Thanks!

17 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Dec 2008, 02:44 PM
Hello,

I tried to reproduce the mentioned error but unfortunately without avail. Please download the attached website (based on the code you shared) and let us know how to modify it in order to recreate this behavior.

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Online .Net Developers
Top achievements
Rank 1
answered on 17 Dec 2008, 03:16 PM
I ran your code and did not receive a JavaScript error, but it did return 'null' for the gridObject variable.

I attached to IE and stepped through the code, and the one difference I saw was that the code called by $find was different.

My original code:
  1. var tableView = gridObject.get_masterTableView();
  2. return $find(this._masterClientID);
  3. function Sys$_Application$findComponent(id,parent){}

The code you gave me:
  1. Same as above.
  2. Same as above.
  3. findComponent:function(b,a){return a?Sys.IContainer.isInstanceOfType(a)?a.findComponent(b):a[b]||null:Sys.Application._components[b]||null}

0
Online .Net Developers
Top achievements
Rank 1
answered on 17 Dec 2008, 03:23 PM
Just realized that I forgot to include the version of the RadControls I'm using.

It's the Q2 2008 install and the version of the Telerik.Web.UI.dll is 2008.2.708.20.

Hope this helps.
0
Daniel
Telerik team
answered on 17 Dec 2008, 03:56 PM
Hello,

Please note that the mentioned issue was fixed since Q2 2008 (version number 2008.2.723).

I recommend you examine our release history for more information.
Release History Q2 2008

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Online .Net Developers
Top achievements
Rank 1
answered on 18 Dec 2008, 11:01 PM
Upgrading to the latest Q3 version fixed this issue.  Thanks!
0
Jason
Top achievements
Rank 1
answered on 28 Aug 2009, 06:42 AM
Hi Daniel

I got the same problem when calling the get_masterTableView method. After I ran the sample code in Repro.zip, I found that the method get_masterTableView runs ok with the setting of below:

<ClientSettings>
             <ClientEvents OnCommand="function(){}" />
            </ClientSettings>
With this setting, the radgrid  automacically displays a few empty rows.

However, if I removed the setting above , it would throw an error like this:  
Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: id

And when I add this setting to my radgrid, the method runs successfully too, but always displays some empty rows before the real data bound to the grid control which causes a flicker every time i reload the grid. 
Should this setting have to be added for the radgrid when the method get_masterTableView is to be used?
0
Daniel
Telerik team
answered on 02 Sep 2009, 11:00 AM
Hello Jason,

If you are binding RadGrid manually on the client, you should handle OnCommand event, otherwise you won't have a client-side object. Therefore when you try to access the master table view you receive an error message.

Please visit the following link for more information:
Client-side binding

"If you are using declarative data-binding and do not bind RadGrid on the server, it will manage to create its client object properly. However, if you are manually binding it on client and do not bind it on server, you need to attach a handler to its OnCommand client event."

To avoid the flickering you could use the following approach:

C#
protected void AGPermissions_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    if (e.Item is GridDataItem) 
        e.Item.Display = false

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
mahesh
Top achievements
Rank 1
answered on 22 Jul 2010, 11:59 AM

I am trying to  Load RadGrid on a button click event  client side(using JSON webservice approch )
I am sepcifying Clientsettings-->DataBinding.Location  and Clientsettings-->DataBinding.SelectMethod using javascript which will get invoked on Button client click event.

function testit() {         

         var ctrl = $find('<%=clientRadGrid.ClientID%>');
         ctrl.ClientSettings.DataBinding.Location = "searchservice.asmx";
         ctrl.ClientSettings.DataBinding.SelectMethod = "GetData";
         var tableView = $find("<%= clientRadGrid.ClientID %>").get_masterTableView();
         tableView.rebind();   
     }

Data is not getting dispalyed in my Grid.Kindly Guide me ....

My  full code is as follow

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadGridClientside.aspx.cs" Inherits="TelerikWorkouts.RadGridClientside" %>
<%@ Register  Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
  
  
<head runat="server">
    <title></title>
     
</head>
<body>
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 <script type="text/javascript">
     function testit() {
         debugger;
  
         var ctrl = $find('<%=clientRadGrid.ClientID%>');
         ctrl.ClientSettings.DataBinding.Location = "searchservice.asmx";
         ctrl.ClientSettings.DataBinding.SelectMethod = "GetData";
         var tableView = $find("<%= clientRadGrid.ClientID %>").get_masterTableView();
         tableView.rebind();
   
  
     }
    </script>
    </telerik:RadCodeBlock>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    <telerik:RadGrid runat="server" ID="clientRadGrid" AutoGenerateColumns="false" EnableAJAX="True">
       <MasterTableView runat="server" AllowPaging="true"  >
        <Columns>
          <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="false" DataField="Name" DataType="System.String" HeaderText="Name" Visible="true">
          </telerik:GridBoundColumn>
           <telerik:GridBoundColumn AllowFiltering="false" AllowSorting="false" DataField="Age"  DataType="System.Int32" HeaderText="Age" Visible="true">
           </telerik:GridBoundColumn>
        </Columns>
       </MasterTableView>    
       <ClientSettings >
          <ClientEvents OnCommand="function(){}" />
         <%--<DataBinding SelectMethod="GetData" Location="searchservice.asmx"></DataBinding>--%>
       </ClientSettings>
    </telerik:RadGrid>
       
     <asp:Button runat="server" Text="show" OnClientClick="testit();" />
    </form>
</body>
</html>
0
Daniel
Telerik team
answered on 28 Jul 2010, 12:22 PM
Hello Mahesh,

Please try to set the location property declaratively and let me know whether this helps.

Regards,
Daniel
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
ControlledKhaos
Top achievements
Rank 1
answered on 26 Aug 2011, 06:25 PM
It would appear that this issue has resurfaced in version 2011.2.712.  I have a site that has a page that is running in a RadWindow that utilizes an asp timer to update data in a RadGrid via a partial page post back.  The RadGrid is being databound on the server via advanced databinding.  The partial page postback also updates a javascript timer that is running to display the time on the client due to a requirement of a process needing to be completed before this time expires.  This process took a significant amount of testing and programming time to finalize and work as required.  All was working well with 2011.1.315.  When I updated my controls to 2011.2.712 I get the "Sys.ArgumentNull Parameter id null" error in the following code:

  function EndRequestHandler(sender, args) {

                if ( postBackElement != null ) {
 
                    //  Get The Current Reservation Wizard Step
                    var intWizStep          = parseInt($get('wStep').value);
                    //  Get The Reservations Grid - Selected Request
                    var masterGrid          = null;
                    //  Get The MasterTable Of The Reservations Grid - Selected Request
                    var masterTable         = null;
                    //  Get The Number Of Data Items In The Grid
                    var dataItems           = null;
                    //  Get The DataKey Of The First Item In The MasterTable Of The Reservations Grid - Selected Request
                    var firstDataItem       = null;
                    //  Find Our Reservations Timer Message Container
                    var requestMessage      = null;
                    //  Get The Time Remaining For The Reservations Timer Message Container
                    var secondsRemaining    = 0;
 
                    switch (true) {
                        case (postBackElement.indexOf("ChoicesTimer") > 0) : case (postBackElement.indexOf("DoNotMoveCheckBox") > 0) :
                            //  Get The MasterTable Of The Reservations Grid - Selected Request
// CODE BLOWS UP HERE ---->masterTable          = $find('<%= ReservationsGridA.ClientID %>').get_masterTableView();                             //  Get The DataKey Of The First Item In The MasterTable Of The Reservations Grid - Selected Request                             firstDataItem        = masterTable.get_dataItems()[0].getDataKeyValue("ID");                             //  Find Our Reservations Timer Message Container                             requestMessage       = $get('<%= RequestMessageSelections.ClientID %>');                             //  Get The Time Remaining For The Reservations Timer Message Container                             secondsRemaining     = GetCurrentTime("CountDownPanel1");                             //  If There Are Items In The MasterTable Of The Reservations Grid - Selected Request                             if (firstDataItem != null && firstDataItem != 0) {                                 //  Show Reservations Timer Message Container                              requestMessage.className = "requestMessage";                                 //  Continue The Reservations Checkout Timer                              ActivateCountDown("CountDownPanel1", secondsRemaining, null);                             }                             if (secondsRemaining <= 0) {                                 //  Show Reservations Timer Message Container                              requestMessage.className = "requestMessageHide";                                 //  Stop The Reservations Checkout Timer                                 DeactivateCountDown("CountDownPanel1");                             }                             break;

  

Please do not request the project because that is impossible. I have rolled my project
back to version 2011.1.315 and currently have no plans on moving to 2011.2.712. Needless
to say I am very disappointed with this development.


 
0
GTL Dev
Top achievements
Rank 2
answered on 31 Aug 2011, 11:24 PM
Having the same issue, is this going to be resolved?
0
Daniel
Telerik team
answered on 01 Sep 2011, 09:10 AM
Hi guys,

I will do my best to recreate this problem at my side but I need to know two things:
- .NET Framework version
- the name of the event (OnRequestEnd, OnGridDestroying, OnTableDestroying, etc) where the problem has occurred.

Thanks,
Daniel
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
ControlledKhaos
Top achievements
Rank 1
answered on 01 Sep 2011, 01:47 PM
I tried it with both .NET Framework 3.5 and 4 and the error is occuring in the OnRequestEnd event.

Thanks.
0
Daniel
Telerik team
answered on 06 Sep 2011, 12:56 PM
Hi guys,

I tried to replicate this scenario but seems that I'm missing something because I didn't notice any problem.
Please find attached my sample project (bundled with assemblies).

Regards,
Daniel
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
ControlledKhaos
Top achievements
Rank 1
answered on 25 Oct 2011, 12:07 AM
Substitute a AjaxToolKit:ToolkitScriptManager in your project and then see what happens.  I have tried to resolve this issue with both .NET Framework 3.5 and 4, AjaxToolKit 3.4 and 4, RadScriptManager and the error is occuring in the OnRequestEnd event every time.  I have got to find a resolution to this problem.



0
Daniel
Telerik team
answered on 28 Oct 2011, 01:55 PM
Either I'm missing an obvious step or there is something else needed to reproduce the issue.
I've tried RadScriptManager, ScriptManager and ToolkitScriptManager.
If you want me to look into this issue, please submit a simplified runnable project via the support ticket system.

Thanks,
Daniel
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
0
ControlledKhaos
Top achievements
Rank 1
answered on 28 Oct 2011, 02:09 PM
Daniel,

Thanks for get back to me.  Finally resolved this issue.  It was an issue with the datagrid not being rebound eventhough rebind was explicitly being called.


Tags
Grid
Asked by
Online .Net Developers
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Online .Net Developers
Top achievements
Rank 1
Jason
Top achievements
Rank 1
mahesh
Top achievements
Rank 1
ControlledKhaos
Top achievements
Rank 1
GTL Dev
Top achievements
Rank 2
Share this question
or