Skip to main content

Posts

Showing posts with the label ASp.NET

.NET Introduction,What is .NET? Scope of .NET

.NET is a common technology  and it support multiple framework that is used to create a different type of application using multiple programming languages . . NET is not a programming language , It provides a platform to compile and execute many programming languages including C#, VB, J#, F#, C++, etc. .NET was developed by Microsoft to enhance the VB6.VB language was platform-dependent and it is only for a desktop application. .NET was created to develop a desktop and web-based application that can easily work on intranet (LAN) and internet-based applications. .NET means network enable technology. now .NET supports 90+ programming languages using a single framework hence .NET is also called multilanguage technology. Type of application of .NET:- 1) Standalone application or Desktop application:-  This type of application will be installed separately for each machine and it works individually for each PC. 1.1)  Windows Forms Application: -  for normal desktop applica...

What is Web Application

What is WEB Application:- This is the application that provides a collection of web pages and hosted on a web server. The web application can be accessed by a network using LAN , MAN , and WAN . Web applications can be operated by the Internet(WWW)  and Intranet (LAN)  using User-Agent or Web Browser. WWW means worldwide web means we can access applications from anywhere using Internet Protocol. Web applications use Client-Server Architecture means web pages are hosted under web servers and it will be requested by URL using a web browser. Client means Web browser means user machine. Server means Web server which contains a web page it can be localhost(127.0.0.1)  or Remote server(www.google.com) ..................................................................................................................................................... The web application will be developed by the client-side and server-side script. Client-Side      ...

ASP.NET MVC Framework Architecture, What is MVC

ASP.NET MVC Framework:- ........................................................................................................................................................... It is a modern web framework of MICROSOFT which provides a secure, lightweight framework to design and develop a dynamic web application. It is compatible with different design codes such as HTML 5, CSS3, Jquery, Angular JS, Node Js, etc. It provides a Razor view engine to write C# code and HTML code on a single page.MVC provides a secure and dynamic page URL to manage URL Routing. It supports Entity Framework ORM(Object Relational Mapping) tools easily which will be used to perform database operations. ..................................................................................................................................................... What is MVC? ................................................................................... It is a design pattern that is used to dist...

ASP.NET MVC Introduction, Create First Applicatio using MVC

ASP.NET MVC Introduction:- ...................................................................................................................................................................... it is used to create a dynamic web application using the MVC Design patterns. MVC means Model, View, and Controller Model ----> Data Access Layer View ----> Designing Controller ---> logic MVC Provide distributed project structure for a large web application. it provides better performance and security as compared to ASP.NET Classic Web Application. ASP.NET Classic has server-side controls which take more time to process data. Install visual studio, File ----- >  New ----> Project---> Select Web from Left Side bar ----->  ASP.NET MVC4 Web Application ---->  Empty Step1st:- Create Controller  public class HelloController : Controller     {         //         // GET: /Hello/   ...

How many to Send Data From Controller to View, ASP.NET MVC Objects, ViewData, ViewBag and TempData

 ASP.NET MVC  Provide Three Different Types of Objects to Store data and send it into View. 1)  ViewData:-     It is used to store data using key=>value pair, the key is used to provide identity, and data is used to store value. default value of ViewData is 0, if we call ViewData under different ActionMethod then it does not provide an error. ViewData["Key"]=value ViewData["rno"] = 1001 // Object It Stores data in an Object pattern and its scope will be the same controller to view (same request). After Redirection Value will be null of ViewData Object. 2)  ViewBag:-     It is used to store data in an Object pattern, Its scope will be the same controller to the same view similar to ViewData but it is used to manage data type of assigned data implicit.  default value of ViewBag is null, if we call ViewBag under different ActionMethod then it provides an error. Syntax:- ViewBag.key = value ViewBag.a=10  //Int   ...

ASP.NET MVC View to Controller Operation

ASP.NET MVC View to Controller  Operation:-   We can pass View Data (Html form or razor form elements ) using Four different ways 1)    using FormCollection:-       FormCollection is a predefined class that is used to store data using dictionary pattern means key=>value pair, the key will be HTML form element name, and value will be data of HTML form element. Step for FormCollection Object:- 1)    Create Controller and define two different method        First Load Method or GET Method:-           public ActionResult Index()       {            return View()       }       Action Method  or POST Method       [HttpPost]      public ActionResult Index(FormCollection obj)       {            return View()   ...

Type of ActionResult in ASP.NET MVC

Type of Action Result in ASP.NET MVC:- ActionResult is the predefined class that is used to provide the Type of data that will be rendered by the view Object under the Controller. ActionResult is the predefined class of MVC  which has different sub-classes to manage view data. 1) ViewResult:-   It is used to return complete HTML View content under View Page.                             It is used to return content page results under the controller action method.                            it is similar to ActionResult Result but ActionResult is the base class and                                                    ViewResult is the subclass.                  ...

Redirection in ASP.NET MVC

Redirection in ASP.NET MVC:- Using this we can redirect from one controller to another using the controller method,ASP.NET MVC provides three different types of ActionResult method for Redirection. 1)  Redirect()  :- We can pass the complete URL under redirect(), we will use the web URL of the current application or cross-application using Redirect(). public ActionResult Methodname() {          return Redirect("url"); } Example:-  public class URLRedirectionController : Controller     {         //         // GET: /URLRedirection/         public ActionResult Index()         {            // return Redirect("http://shivatutorials.com");             return Redirect("Home/Index");         }     } 2) RedirectToAction():-    We can pass Act...

Linq query for Database Operation using ADO.NET Entity Framework

Linq query for Database Operation using ADO.NET Entity Framework:- Linq means Language Integrated Query, It is a modified form of SQL query, LINQ provides database query using database object, it will treat table component as a model object to perform database operation LINQ is an application-based query language that means we can write queries using c# code. .NET provides an  ADO.NET Entity Framework to manage database operation using NOSQL. in place of SQL, it uses LINQ Query. LINQ performance and security as best compare to SQL query hence for modern application development, we always prefer LINQ query to perform database operation. How to work with Database:- 1)  Right-click on project or APP_Data and create a database. 2) Right-click on the database and open the database. 3)  Create a table using a set of columns 4)  Add data to the table 5)  Right-click on models and  add new item --->  Data ---->  Ado.NET Entity Data Model -=-->...

Create Five Page Web Application Using ASP.NET MVC

Create Five Page Web Application Using ASP.NET MVC:- 1) Create Empty Project 2)  Create Controller on right-click on the Controllers folder and define five HttpGet Method     public class HomeController : Controller     {         //         // GET: /Home/         public ActionResult Index()         {             return View();         }         public ActionResult Aboutus()         {             return View();         }         public ActionResult Services()         {             return View();         }         public ActionResult Gallery()         {             ...

Model First Approach in ASP.NET MVC

Model First Approach in ASP.NET MVC:- This approach is similar to data first approach but we will design table schema from an application and database from the database server. Model First Approach Provide Better Design Pattern as Compare to Data First Because we can create table columns,table keys from an application. Step for Model First:- Create Database From SQL Server or Local Database Server Step 2nd:-  Create MVC Project and Right Click on Models Folder and Create Empty Entity Data Model Step3rd:-   Right Click on edmx file and Add Entity(Table) and Scalar Property( Column) according to the requirement Step4th:-  Right Click on edmx file and click on Generate Database from Model Step5th:-  Copy SQL Script from Model.edmx.sql and Go into the database right click on choose NEW QUERY and Paste SQL SCRIPT. Step7:-  Check Database Table has been created. Step8:-  Now Build Project and Add Controller by Code or By Scaffolding. ...

Code First Approach in ASP.NET MVC

Code First Approach in ASP.NET MVC:- It is Ado.NET Entity Framework mapping pattern which is used to create entity framework schema and Table class using code, We will only set entity framework environment and all code part will be managed by Code First Approach, We will manually create  DataContext Class and Provide Connection String Under it after that we will Create Model Class to declare Table name and Table Column name. Step for Code First Approach:- 1)  Create Model Class and Define set of properties to define column. [Table("Student")]     public class Student     {         [Key]         public int Rno { get; set; }         public String Sname { get; set; }         public String Branch { get; set; }         public int Fees { get; set; }     } 2)  Add ADO.NET Entity Framework in Project. 3)  Create DataCont...

ASP.NET MVC CODE MIGRATION

ASP.NET MVC CODE MIGRATION :- It is used to dynamically change the database schema and Table Schema in code first approach ,By default entity framework has no migration support under code first technique for security concern . If we want to apply migration under project then first open package manager console and type enable-migrations It will create migrations folder under project open configuration.cs and write following code internal sealed class Configuration : DbMigrationsConfiguration<MvcApplication3.Models.StudentDB>     {         public Configuration()         {             AutomaticMigrationsEnabled = true;         }         protected override void Seed(MvcApplication3.Models.StudentDB context)         {             //  This method will be called after migrating to the latest ver...

CRUD Operation using Stored Procedure

CRUD Operation using Stored Procedure :- Stored procedure is used to contain set of SQL quires to provide database operation ,It is pre-compile block of code which will be directly executed when we call it, it provide better performance as compare to SQL query hence we mostly prefer Procedure  in place of SQL Query. Code of Store Procedure:-  First Create Table Student (Rno,Sname,Branch ,.Fees) Column Procedure for Data Insertion :- CREATE PROCEDURE [dbo].sp_add_student(@rno int,@sname varchar(50),@branch varchar(50),@fees int) AS insert into student(Rno,Sname,Branch,Fees) values(@rno,@sname,@branch,@fees) Procedure for Data Selection :- CREATE PROCEDURE [dbo].[sp_get_student] AS SELECT * from Student Procedure for Data Updation :- CREATE PROCEDURE [dbo].sp_update_student(@rno int,@sname varchar(50),@branch varchar(50),@fees int) AS update student set Sname=@sname,Branch=@Branch,Fees=@Fees where Rno=@rno Procedure for Data Deletion:- CREATE PROCED...

Web API in ASP.NET MVC

Web API in ASP.NET MVC:- It is used to contain a set of methods to perform the operation, API means application programming interface which provides a URL to consume functionality from one application to another. It use HttpPost for data insertion ,HttpGet for data selection ,HttpPut for data updation and HttpDelete for data deletion . Web API provides a clean, secure, and light-weight URL pattern to access data from .NET MVC application to another MVC application or cross-platform application. It uses HTTP protocol to communicate data from client to server .we can create REST WEB API using WEB API application which can return data using JSON format or XML format. API UrlTemplate will be different from normal ASP.NET MVC application because in ASP.NET MVC first, we write controller name/method name/data but in Web API first, we write api/controllername method name will depend on operation. Syntax of API Controller  public class ControllernameController : ApiControl...