Thursday, 6 March 2014

Message: Unable to get property 'toUpperCase' of undefined or null reference

Message: Unable to get property 'toUpperCase' of undefined or null reference
Solution:
Add below references.
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
make sure you created : 
var objMyClientCtx = new SP.ClientContext.get_current();
Use below code to get items.
var objMylist = objMyClientCtx.get_web().get_lists().getByTitle("MyListName");
this.objMyItem = objMylist.getItemById(2);
var objMyitem =this.objMyItem;
objMyClientCtx .load(objMyitem );