this is my function (with other lines ive tried/abandoned)…
function DoClicked(eNumber) {
//obj.style = 'bgcolor: maroon';
var eid = 'cat' + eNumber;
//$get(obj).style.backgroundColor = 'maroon';
//var nObj = $get(obj);
var nObj = document.getElementById(eid)
//alert(nObj.getAttribute("style"));
nObj.style.backgroundColor = 'Maroon';
alert(nObj.style.backgroundColor);
//nObj.setAttribute("style", "backgroundcolor: Maroon");
};
This error keeps getting returned even after the last line in the function runs:
Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: method
this function is called with an “OnSuccess” set in my Ajax.ActionLink call (ASP.NET MVC)… anyone any ideas on this? i have these referenced… even when i remove the ‘debug’ versions for normal versions, i still get an error but the error just has much less information and says ‘b’ is undefined (probably a ms js library internal variable)…
<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
also, this is how i am calling the actionlink method:
Ajax.ActionLink(item.CategoryName, "SubCategoryList", "Home", New With {.CategoryID = item.CategoryID},
New AjaxOptions With {.UpdateTargetId = "SubCat", .HttpMethod = "Post", .OnSuccess = "DoClicked(" & item.CategoryID.ToString & ")"},
New With {.id = "cat" & item.CategoryID.ToString})
well, this was the answer i subsequently found out:
so, when you call your function via OnSuccess or OnComplete, you just need to wrap it inside a
"function() {...}"declaration, and you’ll be fine.Its funny how the vs team doesn’t point this out as a ‘correct spec’ way of doing things, yet it is so picky and ambigious about it when its passed normally. Wasted 4 hours on VS2010 RTM – this is dismal. Surely, this is a bug that they’ve made no effort to resolve as it’s been around for some time now.