MS AJAX Library 4.0 Sys.create.dataView

Posted by azamsharp on Stack Overflow See other posts from Stack Overflow or by azamsharp
Published on 2010-04-02T05:51:19Z Indexed on 2010/04/02 5:53 UTC
Read the original article Hit count: 492

Filed under:
|

One again Microsoft poor documentation has left me confused. I am trying to use the new features of the .NET 4.0 framework. I am using the following code to populate the Title and Director but it keeps getting blank.

<script language="javascript" type="text/javascript">

        Sys.require([Sys.components.dataView, Sys.components.dataContext,Sys.scripts.WebServices], function () {

            Sys.create.dataView("#moviesView",
    {
        dataProvider: "MovieService.svc",
        fetchOperation: "GetMovies",
        autoFetch: true          


    });

        });

</script>

And here it the HTML code:

 <ul id="moviesView">

    <li>
    {{Title}} - {{Director}}
    </li>

    </ul>

IS THIS THE LATEST URL TO Start.js file.

Here is the Ajax-Enabled WCF Service:

 [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class MovieService
    {
        [OperationContract]
        public Movie GetMovies()
        {
            return new Movie() { Title = "SS", Director = "SSSSS" }; 
        }
    }

    [DataContract]
    public class Movie
    {
        [DataMember]
        public string Title { get; set; }

        [DataMember]
        public string Director { get; set; } 
    }

© Stack Overflow or respective owner

Related posts about ms

Related posts about AJAX