Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Issue with .NET 4.0?
posted

I have reviewed the videos, downloaded the project, and added the reference and control for the MvcScriptManager.

Running the application, it is returning a Javascript error from the Ajax library. The error is:

"Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys._Application'. Parameter name: instance"

This occurs in:

Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
var baseType = type.getBaseType();
if (baseType) {
var baseMethod = baseType.prototype[name];
return (baseMethod instanceof Function) ? baseMethod : null;
}
return null;
}

I have implemented this with the Javascript Map function:


function map() {
$get("PhoneNumber").value = $find("").get_value);
}
// -->

<script type="text/javascript">
function map() {
$get("PhoneNumber").value = $find("<%= PhoneNumberInput.ClientID %>").get_value);
}
</script>

<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<%: Html.Hidden("PhoneNumber") %>

and have the insert of the IGMvcScriptManager as the last line before the closing of the "using (Html.BeginForm())" statement.

Since your sample project cannot be opened by my verson of Visual Studio 2010, I am wondering if anyone has been able to get that project to work in this environment, or if anyone might know what my issue is.

Thanks.

Parents
No Data
Reply
  • 145
    Offline posted

    I have spent the afternoon trying to figure this out.  It turns out your dynamically generated code is what causes the issue.

    This occurs when the MVC 2 validation libraries and script files are used.  They require the following before any controls are rendered:

     

     

     

     

     

    <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>

     

     

     

    <script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

     

    <% Html.EnableClientValidation(); %>

    The conflict occurs because of some type overridding done in the dynamically generated script files using the Infragistics.Web.Mvc IGMvcScriptManager class. However, it is not this class, per se, that creates the issue.  It is the conflict of the Ajax class being specified in conjunction with the files generated by the ASP Script Manager.  At least, as far as I could figure it out...

    Steps to reproduce:

    1. Create an ASP.NET 4.0 MVC 2 project

    2. Create a view which has an Infragistics and non-infragistics control on it.

    3. Set up the View for Client Side validation, per the MVC 2.0 requirements.

    3. Add the IGMvcScriptManager after the last control.

    4. Run the app.

    I hope we can find a way to use Infragistics with the Client Side validation support of MVC 2.0.

Children