KB Article KA20013
Visible to All Users

Standard JavaScript type is unavailable if there is a DevExpress MVC extension with the same name on a page

Description:
I have created a DevExpress MVC Extension (a editor) for the Model.Number property.

C#
@Html.EditorFor(m => m.Number)

or

C#
@Html.DevExpress().TextBoxFor(m => m.Number).GetHtml()

As a result, the JavaScript Number data type is not available on the client side and the page looks broken.

Answer:
The 'Number' is the name of a standard JavaScript type. When you create an editor with the same name, we register its name on the client side as a window object property. As a result, you can use only an editor's name to get access to it on the client side. However, if the name is equal to the name of one of the standard data types, this causes the issue. If you call the Number.MAX_VALUE constant, you will get 'undefined', since in this case, 'Number' is not a data type, but an editor client object. This causes the issue.
To solve it, I recommend you do not create DevExpress MVC Extensions with names equal to the following:
String
Number
Boolean
Object
Date
Array
Undefined
Null
Id
Type
submit
action
any numeric value
etc.

I also do not recommend you use single-letter names such as 'i', 'j', 'k', etc. since they can be overridden by local variables with the same name.
See Also:
JavaScript Data Types
JavaScript Data Types
Q494916: GridView - DXScript & IndexOf JavaScript error when using input whose name is set to id.

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.