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

Edit: Unable to get value of the property 'toLowerCase': object is null or undefined

9 Answers 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 04 Jun 2012, 03:10 PM

When I add a [DataType(DataType.Currency)] annotation to a field on my view model, when I click the edit button in the grid I am getting the following error in the telerik.textbox.min.js file:

Microsoft JScript runtime error: Unable to get value of the property 'toLowerCase': object is null or undefined

Here is the offending line of code:

if(k.nodeName.toLowerCase()!=="input"&&k.type.toLowerCase()!=="text"

because k.type is undefined

Here is my grid:

@(Html.Telerik().Grid(Model)
          .Name( "Grid" )
          .DataKeys( keys => keys.Add( s => s.AlbumId ) )
          .ToolBar( commands => commands.Insert().ButtonType( GridButtonType.Image ).ImageHtmlAttributes( new
          {
              style = "margin-left:0"
          } ) )
        .DataBinding( dataBinding => dataBinding.Ajax()
            .Select( "AjaxIndex", "StoreManager" )
            .Insert( "Create", "StoreManager" )
            .Update( "AjaxEdit", "StoreManager" )
            .Delete( "Delete", "StoreManager" ) )
          .Columns( columns =>
          {
              columns.Bound( album => album.AlbumId ).Hidden( true ).ReadOnly( true );
              columns.Bound( album => album.Genre ).Width( 75 );
              columns.Bound( album => album.Artist );
              columns.Bound( album => album.Title );
              columns.Bound( album => album.Price ).Width( 75 );
              columns.Command( commands =>
              {
                  commands.Custom( "viewDetails" ).Text( "Album Details" ).DataRouteValues( route => route.Add( s => s.AlbumId ).RouteKey( "AlbumId" ) ).Ajax( true ).Action( "ViewDetailsAjax", "StoreManager" );
                  commands.Edit().ButtonType( GridButtonType.Image );
              } ).Width( 200 ).Title( "Commands" );
 
          })
          .PrefixUrlParameters( false )
          .Scrollable( scrolling => scrolling.Enabled( true ) )
          .Sortable( sorting => sorting.Enabled( true ) )
          .Pageable( paging => paging.Enabled( true ) )
          .Pageable( paging => paging.PageSize( 20 ))
          .Filterable( filtering => filtering.Enabled( true ) )
          .Groupable( grouping => grouping.Enabled( true ) )
          .Footer( true )
          .Selectable()
          .ClientEvents( events => events.OnRowSelect( "onRowSelected" ) )
          .ClientEvents( events => events.OnComplete( "onComplete" ) )
          .Editable( editing => editing.Mode( GridEditMode.PopUp ) )
          .TableHtmlAttributes( new
          {
              style = "table-layout:fixed;"
          } )
      )

and here is the model:

using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
 
namespace TelerikMvcMusicStore.ViewModels
{
    [KnownType(typeof(AlbumViewModel))]
    public class AlbumViewModel
    {
 
        /// <summary>
        ///
        /// </summary>
        [ScaffoldColumn( false )]
        public int AlbumId
        {
            get;
            set;
        }
 
        /// <summary>
        ///
        /// </summary>
        [Required( ErrorMessage = "An album title is required" )]
        [StringLength( 160 )]
        public string Title
        {
            get;
            set;
        }
 
        /// <summary>
        ///
        /// </summary>
        [Required( ErrorMessage = "Price is required" )]
        [DataType(DataType.Currency)]
        public decimal Price
        {
            get;
            set;
        }
 
        /// <summary>
        ///
        /// </summary>
        public string Genre
        {
            get;
            set;
        }
 
        /// <summary>
        ///
        /// </summary>
        public string Artist
        {
            get;
            set;
        }
 
        /// <summary>
        ///
        /// </summary>
        public string ImageUrl
        {
            get;
            set;
        }
    }
}

It works fine if I remove the [DataType] annotation from the Price field but then the input control is a simple textbox rather than the nice numeric textbox. As soon as I add the DataType it errors.

I'm not getting how this works in the example and doesn't work in my project, any insight would be appreciated!

Thanks!!



9 Answers, 1 is accepted

Sort by
0
jfkrueger
Top achievements
Rank 1
answered on 04 Jun 2012, 04:45 PM
Update: k.nodeName is coming across as a <DIV> in my application whereas in the sample application it comes across as an input. Not sure what I am doing incorrectly thought...
0
jfkrueger
Top achievements
Rank 1
answered on 04 Jun 2012, 06:17 PM
Update: This only happens in GridEditMode.PopUp, the other two modes work fine.
0
Daniel
Telerik team
answered on 07 Jun 2012, 01:30 PM
Hello,

This is unknown issue and I couldn't reproduce it on my side. The error seems to be thrown when initializing the Control. Is there another Control or an element in the View with the same ID("Price") as the property name? If there isn't, could you send a small runnable sample so I can check the investigate what exactly is causing the error?

Regards,
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Dan Lehmann
Top achievements
Rank 1
answered on 22 Mar 2013, 08:25 PM
I had this same error, but only in IE 10. Cause for me was I had RadWindowManager defined on a page that was opened in a RadWindow, then when I tried to alert a message from the codebehind with:
RadWindowManager1.RadAlert(msg, 350, 120, "Message", "")

I would get "Unable to get property 'toLowerCase' of undefined or null reference" in IE.

I removed the RadWindowManager from the page opening in the RadWindow and I no longer get the error..
0
Dan Lehmann
Top achievements
Rank 1
answered on 22 Mar 2013, 09:56 PM
can't delete post..
0
Dexter
Top achievements
Rank 1
answered on 16 Apr 2013, 01:32 PM
Confirmed.  I was having the same problem w/ the toLowerCase javascript error in the telerik control RadWindowManager in IE10 when calling it from the code-behind page.  I had to remove the RadWindowManager and use the client side RadConfirm. :-/







0
Mike Hobbs
Top achievements
Rank 1
answered on 25 Apr 2013, 07:00 PM
I'm seeing the same error with Window manager on page and opening a new window from within an existing window.

I have a user control with manager on it.  The code behind this is opening a new RadWindow (as child).  The user control is hosted inside an ASPX page and this ASPX page is currently open as a RadWindow.
0
Mike Hobbs
Top achievements
Rank 1
answered on 07 May 2013, 03:47 PM
Is this issue being worked on?  We have several child RadWindows in use & this problem is also causing an issue with opening child window as maximized (this isn't honored on child window calls).  We are using Internet Explorer 10 - 64 bit.  These all worked fine before IE 10 came along.
0
Dan Lehmann
Top achievements
Rank 1
answered on 07 May 2013, 03:53 PM
I posted a link to this thread in the RadWindow forum to get more exposure:

http://www.telerik.com/community/forums/aspnet-ajax/window/radwindowmanager-in-a-radwindow-errors-in-ie10.aspx

Dan
Tags
Grid
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
jfkrueger
Top achievements
Rank 1
Daniel
Telerik team
Dan Lehmann
Top achievements
Rank 1
Dexter
Top achievements
Rank 1
Mike Hobbs
Top achievements
Rank 1
Share this question
or