JavaScript keeps returning ambigious error (in ASP.NET MVC 2.0)

Posted by Erx_VB.NExT.Coder on Stack Overflow See other posts from Stack Overflow or by Erx_VB.NExT.Coder
Published on 2010-04-30T12:01:32Z Indexed on 2010/04/30 17:27 UTC
Read the original article Hit count: 533

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})

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about asp.net-mvc