Click here to Skip to main content
15,878,809 members
Articles / Web Development / ASP.NET

Partial Rendering Control using JQuery in MVC 2

Rate me:
Please Sign up or sign in to vote.
4.17/5 (8 votes)
13 Jun 2010CPOL5 min read 46.7K   686   24  
This article shows a web custom control that allows partial rendering using JQuery in an MVC 2 web application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Collections;
using System.Web.UI.Design.WebControls;
using System.Web;
using System.Security.Permissions;
using System.Drawing.Design;
using System.Web.Mvc;

namespace JqueryController
{


    public class JqueryController : Panel
        {
       
        public string ClientCallBackFunction { get; set; }      
     
            public JqueryController() {
               
              }
        
            protected override void OnPreRender(EventArgs e)
            {
                
                base.OnPreRender(e);
                this.AddClientResource();              
            }

            private void AddClientResource()
            {
                const string resourceName = "JqueryController.JqueryController.js";
                ClientScriptManager cs = this.Page.ClientScript;
                cs.RegisterClientScriptResource(typeof(JqueryController), resourceName);
                cs.RegisterClientScriptInclude("JqueryInclude", "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js");
            }          
        }
    }

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)


Written By
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.

Comments and Discussions