Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

JS1151: Object does not have such a member

An expression references a member of a class-based object, but the object does not have a member with that name.

If the code is contained in an ASP.NET page, the code might define a constructor function within a <script runat="server"> block that uses the this statement. The expando modifier should be applied to every constructor function definition in a <script runat="server"> block.

For example, the following code for an ASP.NET page uses a constructor function marked with the expando modifier.

<script runat="server">
expando function Person(name) {
   // If the expando modifier was not applied to the definition of Person,
   // the this statment in the following line of code would generate error
   // JS1151 

   this.name = name;

var fred = new Person("Fred");

To correct this error

  1. Make sure that the expression references an existing member of the class-based object and that the member name is correctly spelled.

  2. Make sure to apply the expando modifier to each constructor function declaration in a <script runat="server"> block.

Community Additions

© 2015 Microsoft