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.