Microsoft JScript runtime error: 'undefined' is null or not an object.

5 posts, 0 answers
  1. Gregory
    Gregory avatar
    47 posts
    Member since:
    Sep 2010

    Posted 04 Oct 2010 Link to this post

    Hello Telerik,

    Whenever I load my page, I get this error message: Microsoft JScript runtime error: 'undefined' is null or not an object. Here is the HTML Source:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TelerikTest.aspx.cs" Inherits="FCReport_Website.TelerikTest" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableTheming="True">
            </telerik:RadScriptManager>
     
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="rgDriverLicenseRenewals">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgDriverLicenseExpired">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgPDPRenewals">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgPDPExpired">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgUnpaidFines">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgLicenseRenewals">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgVehicleLicenseExpired">
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rgFuelTransactions">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="rgDriverLicenseRenewals" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgDriverLicenseExpired" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgPDPRenewals" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgPDPExpired" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgUnpaidFines" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgLicenseRenewals" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgVehicleLicenseExpired" UpdatePanelHeight="" />
                            <telerik:AjaxUpdatedControl ControlID="rgFuelTransactions" UpdatePanelHeight="" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
     
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px" width="300px">
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" Skin="Default">
                </telerik:RadAjaxLoadingPanel>
            </telerik:RadAjaxPanel>
     
            <telerik:RadGrid ID="rgDriverLicenseRenewals"
                runat="server"
                AutoEventWireup="True"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgDriverLicenseRenewals_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgDriverLicenseExpired"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgDriverLicenseExpired_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgPDPRenewals"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgPDPRenewals_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgPDPExpired"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgPDPExpired_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgUnpaidFines"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgUnpaidFines_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgLicenseRenewals"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgLicenseRenewals_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgVehicleLicenseExpired"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgVehicleLicenseExpired_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
     
            <br />
            <br />
     
            <telerik:RadGrid ID="rgFuelTransactions"
                runat="server"
                AutoGenerateColumns="True"
                Visible="True"
                AllowFilteringByColumn="True"
                AllowPaging="True"
                AllowSorting="True"
                onneeddatasource="rgFuelTransactions_NeedDataSource">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
        </form>
    </body>
    </html>

    And here's the C# source:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using FCReport_Library.Web;
    using FCReport_Library.Data;
    using System.Text;
    using Telerik.Web.UI;
     
    namespace FCReport_Website
    {
        public partial class TelerikTest : System.Web.UI.Page
        {
            DataSet dsWorkQueue = new DataSet();
     
            protected void Page_Load(object sender, EventArgs e)
            {
                 Session["UserID"] = 20;
                 GetWorkQueue();
            }
     
            private void GetWorkQueue()
            {
                dsWorkQueue = DataAccess.GetDataSetByStoredProcedure("FCReport_GetWorkQueue", Session["UserID"]);
            }
     
            protected void rgDriverLicenseRenewals_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgDriverLicenseRenewals.DataSource = dsWorkQueue.Tables[0];
            }
     
            protected void rgDriverLicenseExpired_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgDriverLicenseExpired.DataSource = dsWorkQueue.Tables[1];
            }
     
            protected void rgPDPRenewals_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgPDPRenewals.DataSource = dsWorkQueue.Tables[2];
            }
     
            protected void rgPDPExpired_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgPDPExpired.DataSource = dsWorkQueue.Tables[3];
            }
     
            protected void rgUnpaidFines_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgUnpaidFines.DataSource = dsWorkQueue.Tables[4];
            }
     
            protected void rgLicenseRenewals_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgLicenseRenewals.DataSource = dsWorkQueue.Tables[5];
            }
     
            protected void rgVehicleLicenseExpired_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgVehicleLicenseExpired.DataSource = dsWorkQueue.Tables[6];
            }
     
            protected void rgFuelTransactions_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                rgFuelTransactions.DataSource = dsWorkQueue.Tables[7];
            }
        }
    }

    I really can't figure this out. Am I leaving out controls? Are they in the correct order? Is my C# code wrong?

    Cheers,
    G
  2. Martin
    Admin
    Martin avatar
    811 posts

    Posted 07 Oct 2010 Link to this post

    Hello Gregory,

    I have reviewed your code and created a small sample based on it. However, I am not able to replicate the issue you have described. Please review the attached project and let me know if I miss something out or in case any further assistance is needed.

    Best wishes,
    Martin
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gregory
    Gregory avatar
    47 posts
    Member since:
    Sep 2010

    Posted 07 Oct 2010 Link to this post

    Hello Martin,

    Thank you for your reply. I've since figured out what the problem could be: RadGrid doesn't handle all SQL Server data types correctly when it's set to auto-generate columns. The error appears when:

    1. There's a NUMERIC field or DATETIME field returned by my Stored Procedure.
    2. I specify every column for each RadGrid, with one exception: If the column is a DATETIME value, I have to convert to it to a VARCHAR value before returning it or this error appears regardless, e.g:

    convert(varchar(10), DateStamp, 111)

    So, to solve the problem I now specify each column for each Rad Grid and convert all my DATETIME values to VARCHAR. This isn't really ideal, I was hoping that the RadGrid would be able to auto-generate columns regardless of data type. I don't know if this is a known issue or bug, or if there's some sort of workaround. Got any ideas?

    G
  5. Gregory
    Gregory avatar
    47 posts
    Member since:
    Sep 2010

    Posted 12 Oct 2010 Link to this post

    *Bump*
  6. Martin
    Admin
    Martin avatar
    811 posts

    Posted 12 Oct 2010 Link to this post

    Hello Gregory,

    I have modified the sample project from my previous post and the grids are now bound to 'datetime' ('BirthDate' and 'HireDate') and 'int' ('EmployeeID') fields from a Sql data base. On my side the project still runs as expected. Please give it a try and let me know if I can help further.

    Regards,
    Martin
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017