aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


by Aamir Hasan   on Thursday, August 19, 2010
In this tutorial, I will show you how to transmit JSON Object. I will also use the jTemplate with jQuery within ASP.NETMVC.... More
by Aamir Hasan   on Tuesday, July 6, 2010
Input logic, business logic, and UI logic is called MVC. MVC is designed on following three attribute. M (model), V (View), C (controller) as you see in Below Diagram.  Model: To build a model with business rules, validation and aggregation logic is called Model. For Example, Linq to SQL.dbml files. View: UI of Application is called View. For Example, Home, Account, Shared three folders in View Folder in this Project. In the Account folder is used for UI for logging and change password. Controller: Logic of application is called Controller. For Example, In this Project Controller folder includes AccountController and HomeController files which contains the  flow of login information  ASP.NET MVC 2 builds on ASP.NET MVC 1.0. MVC 2 can be used with 3.5 SP1 and With ASP.NET 4.O. MVC 2 by default installed on your computer when you install Visual Studio 2010. You can download latest version of MVC from MVC download page.In ASP.NET MVC 2 improves the maintainability of the application. You can Update MVC 1.0 protect to ASP.NET MVC 2. ASP.NET MVC2 introduces new features. New Features Template Helper to use Lambda Expression. Asynchronous Controllers for parallel long running tasks and  enable to Asynchronous Operations Matter Area to split large project to avoid the complexity of the large project. Right Click on your Project in the Solution Explorer, click Add and then click Area. Now you can add forum or admin in the Area Strongly Typed UI Helpers to view model level error instead of all validation Errors. HiddenInputAttribute Class for Templated Helpers when DisplayValue is false nothing will be happen but when DisplayValue is true then input hidden element will be rendered when  displaying model  in editor template Enhancements to ModelBinders Automatic HTML-Encoding Enhancements to ModelBinders supports are: Increasing Security with HTTPS Avoiding the JSON Array Attack Short Notation for AcceptVerbs Attribute Overriding the HTTP Verb Binary Binding Ability to render subsections of site pages   Example Open your Visual Studio 2010. Create New Project, window will be display on your screen, by default .Net Framework 4 is selected. Expand Visual C# and click on Web. Select ASP.NET MVC 2 Web Application as you see in below figure. Unit Test If you want to create Unit Test then select Yes option and give the Test Project name. By default name of the test project is the application project MvcApplication.Tests. You can change the name of project as shown in below figure.     Solution Explorer Project is created as you see in the below Figure. Content folder includes CSS file, Script contains js Files. You have three main folders Controller, Models and Views Controller Below is the Simple HomeController class. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplication.Controllers { [HandleError] public class HomeController : Controller { public ActionResult Index() { ViewData["Message"] = "This is my First MVC Web Project"; return View(); } public ActionResult About() { return View(); } } } Views (Index.aspx Page) Here is the Code of index.aspx Page<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">    <h2><%: ViewData["Message"] %></h2>    <p>        To learn more about ASP.NET MVC visit <a href="" title="ASP.NET MVC Website"></a>.    </p></asp:Content>   Global.asax.cs Default created MVcApplication class in Global.aspx.cs file as shown in below code.   using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace MvcApplication { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit //Author:Aamir Hasan public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } } }   Unit-test project you will add a controller with an action method and a view, and you will add a unit test for the action method. Explorer View  Compile and run the Project and you will see Result in the Explorer   Download Mvc2Application.rar (47.36 kb)  
Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5