views:

476

answers:

2

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.

A: 

You need to ensure that your reference to "jquery.validate.min.js" is AFTER your reference to "jquery.min.js" (or whatever version of the jQuery library you are using). You haven't listed that in your code sample.

Sohnee
Sorry, I should've listed the whole Head section concerning the scripts tags. I do have those scripts in the correct order, so I don't think that's the problem. I'll edit my original post to include the order of scripts.
Shaggy13spe
A: 

Well, I ended up getting jquery validation to work and it doesn't have any conflicts with Start.js. So my script tags end up looking like such:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/beta/0911/Start.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js" type="text/javascript"></script>  
<script src="/Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script> 

The strange thing is, I had to go find the MicrosoftMvcJQueryValidation.js file on the web in someone's example, as it wasn't included in the Scripts folder when I created the solution. Strange.

Shaggy13spe