SIGN UP MEMBER LOGIN:    
ARTICLE

Using Dalegates in ASP.NET MVC

Posted by Manish Singh Articles | ASP.NET MVC with C# December 12, 2011
This is a simple application for beginners that helps with how to create a delegate in an ASP.NET MVC application.
Reader Level:

Introduction: We know that MVC is a integrated modules; that name is the models,views and controlers. ASP.NET MVC is the new version of ASP.NET. In this application we will learn about how to use a delegate in an ASP.NET MVC application to develope a simple module. ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you full control over markup for enjoyable, agile development. The controllers in an ASP.NET MVC application control the flow of application execution. Models is provide a business logic and views is provide a representation of data. This is a simple application for beginners that helps with how to create a delegate in an ASP.NET MVC application. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks.

Step 1: Open Visual Studio 2010.

  • Click file ->New->Projects
  • Add MVC ASP. NET 2 Empty Web application
  • The application name is "manish"
newapp.gif
start.gif

Step 2: Add the class in a program.

  • Right Click on the Models folder
  • Add->Add new items->add class
  • Class name is "sandeep"

openmodel.gif

addclass.gif

Code:

clacode.gif

Step 3: Add a controller.

  • Right Click on the controllers folder
  • Add->controller
  • Controller name is "bhanu"
addcontroller.gif

controller.gif

Code:

classcode.gif

Step 4: Add views.

  • Right Click on the Action result object
  • Add view
  • View name is "Index"
  • Tick a checkbox and create a strong type view
view.gif
addview11.gif

Step 5:
Write the code in the index view.

Code:

vieecode.gif

viewcode.gif

Step 6: Press crtl+f5 to run the program.

Output:

output.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor