Click here to Skip to main content
11,415,046 members (77,155 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
Add your own
alternative version

Partial Rendering Control using JQuery in MVC 2

, 14 Jun 2010 CPOL
This article shows a web custom control that allows partial rendering using JQuery in an MVC 2 web application
JqueryControlMVC.zip
JqueryController
bin
Debug
JqueryController.dll
MvcApplication2.dll
MvcApplication2.pdb
Release
System.Web.Mvc.dll
JqueryController.csproj.user
Properties
JqueryControlMVC
JqueryControlMVC
App_Data
bin
JqueryController.dll
JqueryController.pdb
JqueryControlMVC.dll
JqueryControlMVC.pdb
Content
Controllers
Global.asax
JqueryControlMVC.csproj.user
Models
Properties
Scripts
Views
Account
Home
Shared
UserControl
JqueryControlMVC.suo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JqueryController;
using JqueryControlMVC.Models;

namespace JqueryControlMVC.Controllers
{
    [HandleError]
    public class HomeController : MvcControllerBase
    {
        private const string UserControlPath="~/Views/UserControl/ViewUserControl1.ascx";
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";            
            return View();
            
        }
        [HttpPost]
        public ActionResult Index(string x)
        {
            
            if (this.IsPartialRendering && this.PostParameter.ContainsKey("action"))
            {
                switch (this.PostParameter["action"])
                { 
                    case "refreshTime":
                        TimeModel t = new TimeModel();
                        return this.RefreshJQueryPanel<TimeModel>("JqueryController1", UserControlPath, t,"CallBack","parameterToBeReturned" );
                        break;
                 //any other action
                }
                
            }
            return View();
        }

        public ActionResult About()
        {
            return View();
            
        }
    }
}

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

Massimiliano Peluso "WeDev Limited"
Architect PeluSoft Limited
United Kingdom United Kingdom
I have been fascinated by software development since I was 10 years old. I'm proud of learned the first programming language with an Olivetti PC 128S based on Microsoft BASIC. I'm a Software Architect/Senior Developer with a strong background of all the developing Microsoft's technologies.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150427.4 | Last Updated 14 Jun 2010
Article Copyright 2010 by Massimiliano Peluso "WeDev Limited"
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid