Posts

Showing posts from February, 2020

Controllers In MVC By Sagar Jaybhay

Image
In this article you will understand what Is Controllers In MVC and What is the use of Controller in Asp.Net MVC. Controllers In MVC In MVC the URLs are mapped to the Controllers action method so the question is how URLs are mapped to the Controllers action method? The answer for that ASP.NET routing. It is registering in Global.asax file. Gloabl.asax File In MVC The Registeroute method Is present in RouteConfig.cs file see below image, RegisterRoute Method In MVC Below is the RegisterRoute method in that class file. public static void RegisterRoutes(RouteCollection routes) routes.IgnoreRoute("resource.axd/*pathInfo"); routes.MapRoute( name: "Default", url: "controller/action/id", defaults: new controller = "Home", action = "Index", id = UrlParameter.Optional ); } In the above code, you can see, the Default route is present it means if you simply run the application then it will invoke this URL path the normal path whic

Controllers In MVC By Sagar Jaybhay

Image
In this article you will understand what Is Controllers In MVC and What is the use of Controller in Asp.Net MVC. Controllers In MVC In MVC the URLs are mapped to the Controllers action method so the question is how URLs are mapped to the Controllers action method? The answer for that ASP.NET routing. It is registering in Global.asax file. Gloabl.asax File In MVC The Registeroute method Is present in RouteConfig.cs file see below image, RegisterRoute Method In MVC Below is the RegisterRoute method in that class file. public static void RegisterRoutes(RouteCollection routes) routes.IgnoreRoute("resource.axd/*pathInfo"); routes.MapRoute( name: "Default", url: "controller/action/id", defaults: new controller = "Home", action = "Index", id = UrlParameter.Optional ); } In the above code, you can see, the Default route is present it means if you simply run the application then it will invoke this URL path the normal path whic

Override Function & Inheritance in JavaScript

Image
In this article we will understand how to Override Function in JavaScript and How to Implement Inheritance in JavaScript by Sagar Jaybhay . Overriding Function In JavaScript Javascript supports overriding but not overloading. When you define multiple functions in javascript and included it in the file then the last one is referred by the javascript engine. Override Function In JavaScript Original Javascript File which we refer function Employee(name) this.Name=name; Employee.prototype.getgreeting=function() return "Hello, "+this.Name; Now as per requirement we want to override getgreeting function then we create a new file and below code to override this function and include this both file in our index.html file. Employee.prototype.getgreeting=function() return this.Name.toUpperCase(); var emp=new Employee("xyz"); alert(emp.getgreeting()) Inheritance In JavaScript Object-oriented programming languages like C#, Java support inheritance, and javascript is

Override Function & Inheritance in JavaScript

Image
In this article we will understand how to Override Function in JavaScript and How to Implement Inheritance in JavaScript by Sagar Jaybhay . Overriding Function In JavaScript Javascript supports overriding but not overloading. When you define multiple functions in javascript and included it in the file then the last one is referred by the javascript engine. Override Function In JavaScript Original Javascript File which we refer function Employee(name) this.Name=name; Employee.prototype.getgreeting=function() return "Hello, "+this.Name; Now as per requirement we want to override getgreeting function then we create a new file and below code to override this function and include this both file in our index.html file. Employee.prototype.getgreeting=function() return this.Name.toUpperCase(); var emp=new Employee("xyz"); alert(emp.getgreeting()) Inheritance In JavaScript Object-oriented programming languages like C#, Java support inheritance, and javascript is

Static Members & Prototype In JavaScript 2020

In this article we will Understand Static Members In JavaScript ,How to declare Static Variables and Prototype In JavaScript by Sagar Jaybhay. Static Members In JavaScript Static properties and methods are those that don’t change with one instance to another instance. Also, if we declared static function then these functions can be used without creating an object of a class. In javascript, there is no special syntax to denote static member but we can make use of constructor function name to declare static fields or static methods in Javascript. The static variable is not created every time when an object is created. function Shape()1; // this is static function Shape.GetTotalCount=function() return Shape.Count; // below is the instance variable this.val=0; var shape1=new Shape(); var shape2=new Shape(); var shape3=new Shape(); alert(Shape.GetTotalCount()); Prototype In Javascript All javascript object inherits properties and method from a Prototype. Javascript is a protot

Test Post from Sagar Jaybhay

Test Post from Sagar Jaybhay https://sagarjaybhay.net

Properties In Javascript By Sagar Jaybhay 2020

In this article we will understand Properties in Javascript . How to write properties in Javascript and What is the use for Properties In JavaScript . In object-oriented programming languages class have 3 types of properties Read/ Write properties Read-only properties Write only properties class Employee string _name; int _salary; public Employee(string name,int salary) _name=name; _salary=salary; //read/write proerties public int salary getreturn _salary; set_salary=value; //read only property public string nameget; //write only property public string emailset; Why we need properties? Encapsulation is one of the pillar of object-oriented programming. Properties provide encapsulation. If you provide public fields you can not have more control over it but if you use properties then you have control. function Employee(salary) this.Salary=salary; var emp=new Employee(-1); In the above example, we are setting salary =-1 which is wrong to overcome this kind of situation we requ

Test Post from Sagar Jaybhay

Test Post from Sagar Jaybhay https://sagarjaybhay.net

Test Post from Sagar Jaybhay

Test Post from Sagar Jaybhay https://sagarjaybhay.net