text: Hi Friend, Here i will show you how to pass data (information) from Controller to View in asp.net mvc framework .Here i will use only Controller and View components of the MVC template. We will learn each concepts of MVC one by one from simple level to difficult level. First we shall learn "How to create MVC template in Your visual studio".
  There are some steps to implement this concepts in your visual studio as given below:-
  Step 1 :- First open your visual studio --> File--> New-->Project --> Web -->Select ASP.NET MVC2 Empty Web Application as shown below:-
  - If you are using visual studio 2008 with sp1 or any or free visual web developers 2008 express with sp1,It's not include MVC 2 by default.You can download ASP.NET MVC 2 template from and install it.
  - If you are using visual studio 2010 any edition.it's already include ASP.NET mvc 2 by default.
  - If you are using Visual studio 2012 or Visual studio 2013 edition, then default template may be changed.but concepts is same for all MVC template (eg. MVC , MVC2 , MVC3 , MVC4.MVC5, MVC6 ) .
  Step 1 :- First open your visual studio --> File--> New-->Project --> Web -->Select ASP.NET MVC2 Empty Web Application as shown below:-
  Step 2 :- Now open solution Explorer --> You see the following components (Model, View , Controller) as shown below:-
  Step 3 :- Now Right click on Controller Folder in Solution Explorer window -->Add --> Controller --> Write Controller Name (MyfirstController) --> Press Add Button as shown below:-
  Step 4 :- Now write the c# codes in controller class as given below:-
  using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace FirstMVC_Application.Controllers { public class MyfirstController : Controller { // // GET: /Myfirst/ public ActionResult Index() { ViewData["title"] = "Welcome to"; ViewData["Date_Time"] = DateTime.Now.ToString(); return View(); } } }
  Step 5 :-Now Right click on ActionResult in coding part --> Add view as shown below:-
  Step 6 :- Now open Index.aspx page --> write the codes as given below:-
  Note:- You can see,Index.aspx page in your View Folder in your solution Explorer Window.You can add Index.aspx page from here also after right click on Myfirst folder inside view folder.Note:- You can see,Index.aspx page in your View Folder in your solution Explorer Window.You can add Index.aspx page from here also after right click on Myfirst folder inside view folder.
  <%@ Page <html xmlns="" > <head runat="server"> <title>Index</title> </head> <body> <div> <b> <%= ViewData["title"] %></b> <br /> The current Date and time in your System is: <%= ViewData["Date_Time"] %> </div> </body> </html>
  Step 7 :-Now Run the Application (Press F5) --> You will see following error as shown below:-
  Note:-This error came because we didn't invoke any Actions.
  Step 8 :- I have already created Myfirst Action but didn't invoke it.So type the URL as show below in Snapshot.
  Note :- This Myfirst action invokes the Index.aspx page and display it on the browser screen.
  For More...
  - How to implement Page life cycle concepts in asp.net
  - Introduction of Trigger in sql server
  - How to implement WCF service in asp.net application
  - How to create generic handlers in asp.net
  - How to implement cookie concepts in asp.net
  - How to implement validation control in asp.net
  - How to implement exception handling concepts in c#
  - String and string builder concepts in c#
  Download