ASP.NET MVC2: Client-side validation not working with Start.js

Posted by Shaggy13spe on Stack Overflow See other posts from Stack Overflow or by Shaggy13spe
Published on 2010-04-28T20:06:05Z Indexed on 2010/05/10 19:14 UTC
Read the original article Hit count: 601

Ok, this is strange. I would hope it's something I'm doing wrong and not that MS has two technologies that simply don't work together. (UPDATE: See bottom of post for Script tag order in HEAD section)

I'm trying to use the dataView template and client-side validation. If I include a reference to:

<script src="http://ajax.microsoft.com/ajax/beta/0911/Start.js" type="text/javascript"></script>

by itself, the dataview template works fine. but if I put in the following references:

<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js" type="text/javascript"></script> 
 <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

then I get the following error:

> Error: Type._registerScript is not a
> function Source File:
> http://ajax.microsoft.com/ajax/beta/0911/MicrosoftAjaxTemplates.js
> Line: 1

and:

> Error: Sys.get("$listings") is null
> Source File:
> http://localhost:12370/Listings Line:
> 76

Here's the code calling the dataview:

$(document).ready(function () {
        LoadMap();

        Sys.require([Sys.components.dataView, Sys.scripts.jQuery], function()       {         
        $("#listings").dataView();   
        Sys.get("$listings").set_data(listings.Data);    
        updateMap(listings.Data);       
        });  
    });    

I would really appreciate any help with this one. Thanks!

UPDATE:

I've tried moving around the order of the last 4 script tags, but to no avail.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about dataview