Click here to Skip to main content
12,511,648 members (45,442 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads

Stats

137.2K views
3.9K downloads
180 bookmarked
Posted

jQuery Templates/View Engines in ASP.NET MVC

, 25 Apr 2012 CPOL
This article explains how client-side view engines can be used in ASP.NET MVC.
LoadJSON
bin
LoadJSON.dll
Content
images
details_close.png
details_open.png
logo17.jpg
logo18.jpg
logo19.jpg
logo20.jpg
logo21.jpg
stripe.png
title.gif
Controllers
Global.asax
LoadJSON.csproj.user
Models
obj
Debug
TempPE
Properties
Scripts
using System;
using System.Collections.Generic;

namespace LoadJSON.Models
{
    public class DataRepository
    {

        public static IList<Company> CompanyData = null;
        public static IList<Company> GetCompanies()
        {
            if (CompanyData == null)
            {
                CompanyData = new List<Company>();
                CompanyData.Add(new Company()
                {
                    Name = "Emkay Entertainments",
                    Address = "Nobel House, Regent Centre",
                    Town = "Lothian",
                    Contact = "Phone",
                    IsFeatured = true,
                    Logo = "/Content/images/logo17.jpg",
                    Country = new[] { "UK", "USA" },
                    Manager = new Employee { FirstName = "Nick", LastName = "Donovan" },
                    Employees = new Employee[] { new Employee { FirstName = "John", LastName = "Doe" },
                                                                             new Employee { FirstName = "Alex", LastName = "Watkins" },
                                                                             new Employee { FirstName = "Mick", LastName = "Henning" }
                                                }
                });
                CompanyData.Add(new Company()
                {
                    Name = "The Empire",
                    Address = "Milton Keynes Leisure Plaza",
                    Town = "Buckinghamshire",
                    Contact = "Post",
                    Logo = "/Content/images/logo18.jpg$Logo for company with id 18",
                    IsFeatured = false,
                    Manager = new Employee { FirstName = "Ana", LastName = "Frank" },
                    Employees = new Employee[] {    new Employee { FirstName = "Mark", LastName = "Anderson" },
                                                                                new Employee { FirstName = "John", LastName = "Haus" },
                                                                                new Employee { FirstName = "Sinthia", LastName = "Clouny" } }
                });
                CompanyData.Add(new Company()
                {
                    Name = "Asadul Ltd",
                    Address = "Hophouse",
                    Town = "Essex",
                    Contact = "Email",
                    Logo = "/Content/images/logo19.jpg$Logo for company 19",
                    Country = new[] { "UK" },
                    Manager = new Employee { FirstName = "John", LastName = "Feigan" },
                    Employees = new Employee[] { new Employee { FirstName = "Micheal", LastName = "King" },
                                                                             new Employee { FirstName = "Jody", LastName = "Palmer" },}
                });
                CompanyData.Add(new Company()
                {
                    Name = "Star Records",
                    Contact = "Email",
                    Logo = "/Content/images/logo20.jpg",
                    Country = new[] { "SRB" },
                    Manager = new Employee { FirstName = "Steve", LastName = "Carter" },
                    Employees = new Employee[] { new Employee { FirstName = "Andrea", LastName = "Smith" }, 
                                                                             new Employee { FirstName = "Jane", LastName = "Anderson" } ,
                                                                             new Employee { FirstName = "Anthony", LastName = "Willis" },
                                                                             new Employee { FirstName = "George", LastName = "Hill" },
                }
                });
                CompanyData.Add(new Company()
                {
                    Name = "Ashley Mark Publishing Company",
                    Address = "1-2 Vance Court",
                    Town = "Tyne & Wear",
                    IsFeatured = true,
                    Country = null,
                    Manager = new Employee { FirstName = "Micheal", LastName = "Johnson" },
                    Employees = new Employee[] { new Employee { FirstName = "Micheal", LastName = "Sharp" },
                                                                             new Employee { FirstName = "Jeff", LastName = "Cave" }, 
                                                                             new Employee { FirstName = "Peter", LastName = "Hayward" },
                                                                            }
                }); 
            }
            return CompanyData;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jovan Popovic
Program Manager Microsoft
Serbia Serbia
Graduated from Faculty of Electrical Engineering, Department of Computer Techniques and Informatics, University of Belgrade, Serbia.
Currently working in Microsoft as Program Manager on SQL Server product.
Member of JQuery community - created few popular plugins (four popular JQuery DataTables add-ins and loadJSON template engine).
Interests: Web and databases, Software engineering process(estimation and standardization), mobile and business intelligence platforms.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160929.1 | Last Updated 26 Apr 2012
Article Copyright 2011 by Jovan Popovic
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid