Krishan Dutt Sharma

Web Developer

My Blog

How To Use .filter() In Angular

In this blog, you are going to see how to use .filter() function in Angular. I will explain to you how it works with a simple example. You have an array containing multiple objects, each one representing an employee, but only want some of the objects in it. That’s where .filter() comes in.

Read More

Angular Data Binding

Introduction Data binding is one of the most important features in any language. It allows us to define communication (synchronization) between the model and view. Data binding is passed from component to view and from view to the component. Types of Data Binding in Angular String Interpolation: The type of one-way data binding where the text is between a set of curly braces often uses the name of a component property. The syntax of string interpolation is to use double curly braces {{code}}, also known as moustache syntax.

Read More

Create Custom Textbox In Angular 8 Using Input And Output Decorators

Input and Output decorators are used to pass values from one component to another component in Angular. Usually, Input parameters pass values from the parent component to child component and Output parameters are used to pass values from the child component to the parent component. We will create a child component as a custom textbox component and get values from parent component which uses this custom child component. We will use the same input parameter for getting model value from the custom component as well. For this, we will use an Output parameter with an event emitter variable as a string. We will use another input decorator for getting the maximum number of characters that custom textbox can accept. If we give zero as the maximum character length, the custom textbox will allow unlimited characters. We will write the logic for that inside our custom component. We will also provide one more input decorator to restrict numeric values inside the custom textbox if needed. We will write that logic as well.

Read More

@Input() And @Output() Decorator In Angular

Introduction In this article, I am exploring two very important points, related to Angular 2 + version, which the part of Parameter Decorator and these points are called @Input and @Output decorators. Both are used to transform the data from one component to another component. Or, you can say pass the different types of data from parent to child component and child to parent component. Or, in a simple way transform/exchange data between two-component.Let's explore each, one by one. @Input Decorator @Input is a decorator to mark a property as an input. @Input is used to define an input property, to achieve component property binding. @Inoput decorator is used to pass data (property binding) from parent to child component. The component property should be annotated with @Input decorator to act as input property.

Read More

Element in ASP.NET MVC View

It provides an easy way to Render HTML in our View. The following is the list of Html Helper controls. Html.Beginform Html.EndForm Html.Label Html.TextBox Html.TextArea Html.Password Html.DropDownList Html.CheckBox Html.RedioButton Html.ListBox Html.Hidden Below are Strongly Type Html Helper methods, this will allow us to check compile time errors. We get Model’s Property intelligence at Runtime. Html.LabelFor Html.TextBoxFor Html.TextAreaFor Html.DropDownListFor Html.CheckBoxFor Html.RadioButtonFor Html.ListBoxFor Html.HiddenFor Let’s dig intothe details, we have to design one registration form using above controls shown as per below screen. Here we have Label, Textbox, Password, Radio button, DropDown, and Checkbox. In ASP.NET Application we have Server Controls, so we just need to drag and drop from the Toolbox and design the page easily, but here in MVC Application, we don’t have Server Control so either we can use HTML or Html Helper Class Controls.

Read More

Razor View Engine in MVC.

Today, in this Article we learn about the Razor View Engine. Overview Razor Engine is an advance view engine that was introduced with MVC 3. This is not a new language but it is a new markup syntax. Ths namespace for razor engine is System.Web.Razor. The file extension used with Razor Engine is different from web form Engine. It has .cshtml or .vbhtml extension for View, Partial View, editor template and for layout pages. “Razor” was in development beginning in June 2010 and was released for Microsoft Visual Studio in January 2011.

Read More

Asp.Net MVC Architecture

Asp.net MVC Architecture separates an application into three parts Model-View-Controller(MVC). MVC Architecture provides good “separation of concerns” in general “Loose coupling”. Following image shows how asp.net MVC architecture flow will beModel- The “M” in MVC : The model represents a set of classes that describe the business logic and data. it also defines business rules for how the data can be changed and manipulated. Models in Asp.net MVC handles the data access Layer by using OTM tools like Entity Framework or NHibernate etc. ByDefaults, Models are stored in the Models Folder of the Project.

Read More

Routing In MVC 5

What is Routing : Routing is a mechanism to process the incoming URL that is more descriptive and gives desired response. In this case, URL is not mapped to specific files or folder as was the case of earlier days websites. There are two types of routing Convention based routing – to define this type of routing, we call MapRoute method and set its unique name, URL pattern and specify some default values. Attribute-based routing – to define this type of routing, we specify the Route attribute in the action method of the controller.

Read More

ASP.NET MVC Application Folder Structure

In This Article we learn, How to Create a demo MVC Project using Visual Studio 2013 Community Edition. So, Friends lets Start with the creation of new Project. Create New Project in Visual Studio 2013 which we learn our previous article “Create A New ASP.NET MVC Project In Visual Studio 2013” ASP.NET MVC Folder Structure It is very important to Know about the folder Structure of asp.net MVC. It will help you to add files to an appropriate folder. Visual Studio creates the following folder structure of MVC application by default. App_Data: In MVC Folder Structure First Folder is App_Data which contains data files like LocalDB, .mdf Files, XML files and other data related files. IIS will never serve files from App_data Folder.

Read More

Create A New ASP.NET MVC Project In Visual Studio 2013

This Article is for Beginners, Who just Start with Asp.net MVC and Visual Studio 2013. In this article, i am using Visual Studio 2013 Community Edition. Step-1 Open Visual Studio. You can open the Visual Studio in many ways which are I explain below: Click the Start button and type “v” in the “search” box. It will listed the programs (including Visual Studio) and select the Visual Studio.

Read More

ASP.NET MVC Basics

ASP.NET MVC stands for ASP.NET Model View Controller design pattern. MVC was first invented by Trygve Reenskaug and was named as “Thing Model View Editor” pattern originally. Slowly it became popular and renamed as “Model View Controller”. ASP.NET MVC was created by Scott Guthrie of Microsoft in 2007 based on the MVC framework implemented in different framework like Ruby on Rails, Spring etc. ASP.NET MVC (Model View Controller) is an architectural design pattern that separates an application into three main components

Read More

ASP.NET MVC Application Folder Structure

In This Article we learn, How to Create a demo MVC Project using Visual Studio 2013 Community Edition. So, Friends lets Start with the creation of new Project. Create New Project in Visual Studio 2013 which we learn our previous article “Create A New ASP.NET MVC Project In Visual Studio 2013” ASP.NET MVC Folder Structure It is very important to Know about the folder Structure of asp.net MVC. It will help you to add files to an appropriate folder. Visual Studio creates the following folder structure of MVC application by default.

Read More

Create A New ASP.NET MVC Project In Visual Studio 2013

This Article is for Beginners, Who just Start with Asp.net MVC and Visual Studio 2013. In this article, i am using Visual Studio 2013 Community Edition. Step-1 Open Visual Studio. You can open the Visual Studio in many ways which are I explain below: Click the Start button and type “v” in the “search” box. It will list the programs (including Visual Studio) and select the Visual Studio.

Read More

jQuery Ajax Function: Call Code-behind C# Method

In this article we will learn how to implement an ajax method in jQuery. There is no need to explain that ajax is one of the strong pillars of the future of web development. Since ajax is a concept or technique we can implement ajax with any web development platform. It is possible to implement ajax with PHP or with JSP or with ASP.NET or with many other technologies. Since we are learning .NET, in this article we will explain ajax in the context of C# .NET.

Read More

Way to Call Controller Actions From HTML Using jQuery

When writing MVC code you cannot forget jQuery. jQuery provides a substantial contribution to make your application faster. The following is what is to be discussed: using $.get() using $.post() using $.ajax() using URL (JavaScript style) When you are writing jQuery code, one thing to keep in your mind is that you need to minimize page loading/refreshing.

Read More

Difference Between MVC And Web Forms

I will explain what MVC is and how it is different from web forms. I will start a series of learning MVC soon. What is MVC? Let's start first with what is MVC? In a general sense, MVC stands for Model-View-Controller. It is a software design pattern. It is different from MVVM pattern. MVC is a pattern based on separation of concerns, which means that View, Model and Controller are independent of each other. As a result, working in teams, maintenance and testing of the application become simpler and easier. So, now what is this Model, View and Controller?

Read More

Export Data To PDF From DataTable

In this Article, I am showing how we can export the data into PDF format from Datatable, for this first of all we create a table in SQL i.e Called tbl_EmpDetails.

Read More

Delete Duplicate Record From SQL Database Using CTE

How to delete duplicate records from a SQL data table using CTE (common table expression). Specifies a temporary named result set, known as a common table expression (CTE).

Read More

Google reCAPTCHA In ASP.NET MVC

reCAPTCHA is a free service that protects your website from spam and abuse. This blog shows how to implement reCAPTCHA version 2.0 into an ASP.NET MVC website. Login to your Google account, then go to the below link. https://www.google.com/recaptcha/admin#list Enter your details in the register a new site section. Add a label to identify the site, choose “reCAPTCHA V2" and then add a list of domains. Also, remember to add localhost if you intend to test it on your local machine,

Read More

Using AJAX In ASP.NET MVC

As we all know, AJAX means Asynchronous JavaScript and XML. It is a client-side script that communicates to and from a server/database without the need for a postback or a complete page refresh. The Ajax speeds up response time. In other words, Ajax is the method of exchanging data with a server, and updating parts of a web page, without reloading the entire page.

Read More

How to Create Web API in ASP.Net MVC

Web API The ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. The ASP.NET Web API is an ideal platform for building Restful applications on the .NET Framework. Referred from “Microsoft.com”.

Read More

Creating ASP.NET Web API REST Service

Today's application needs to be communicated on all cross platforms to fulfill the need of today's modern application, to fulfill these requirement lots of technologies are invented and they are used as per requirement. The Web API is one of the latest technology to fulfil the requirement of enterprise application.

Read More

Passing Values From JavaScript Functions to ASP.Net Functions in ASP.Net

Sometimes it necessry to values from a JavaScript function to an ASP.Net function. For example, we have a table and a GridView control on a page. In our table there are fields such as Employee Name, Age and Salary of the Employee and the condition is that only those employees should be added to the database whose age is greater than or equal to 25 and we want to carry out the validation process using JavaScript on a single click event of a button control and if the age is greater than or equal to 25 it should be added to the database and the corresponding records should be displayed in the GridView control.

Read More

How To Enable HTTPS In ASP.NET Web API

In this article, you will see how we can enable HTTPS in ASP.NET Web API. We will start by discussing all the steps required to enable HTTPS in ASP.NET web API. And then we will discuss all the steps in detail. Also, you will see how we can enable HTTPS support for the development server.

Read More

Filters In ASP.NET MVC

his article will tell you almost everything about filters used on action methods as well as on controllers in ASP.NET MVC. I am writing this article to tell you the basic to advanced foremost concepts about filters.Last week one of my friends asked the question “How can I restrict the users to use my resources on the website?” I am dedicating this article to him. I hope he will like this.The topics to be covered are,

Read More

Validation In ASP.NET MVC Model Binding Using jQuery

jQuery Validation in model binding is used to check if the user has entered all the valid text in input fields or not. This is done before submitting the form to the server so that server-side load lifting can be minimized. We are using Data Annotation validators to perform the validation in an ASP.NET MVC application in model binding simply by adding one or more attributes – such as the required or StringLength attribute – to a class property.

Read More

Naming Conventions In C#.Net

For any developer, Naming Conventions is a best practice when working on any development project. Let’s discuss more about Naming Conventions in this article. Why Naming Conventions? Naming Conventions are very important to identify the usage and purpose of a class or a method and to identify the type of variable and arguments. Types of Naming Conventions Below are the two major parts of Naming Conventions. Pascal Casing (PascalCasing) Camel Casing (camelCasing)

Read More

Design Patterns in C#

What is design Pattern in c#? Design Patterns are categorized into 3 types and they are: Creational Design Patterns. Structural Design Patterns. Behavioral Design Patterns. What are Creational Design Patterns? These patterns deal with the process of objects creation. The flowing are the different types of Creational Design patterns. Abstract Factory Pattern - Createinstances of several classes belonging to different families. Factory Pattern - Create instances ofderived classes. Builder Pattern - Separates an objectconstruction from its representation. Lazy Pattern - Create a duplicate objector clone of the object.

Read More

Delegates and Events In C#

Delegates and events are a fundamental concept yet complex in .NET and C# language. This article explains basic concepts of delegates and events and how they are used in a .NET and C# application. Delegates Delegate is one of the base types in .NET. Delegate is a class, which is used to create delegate at runtime. Delegate in C# is similar to a function pointer in C or C++. It's a new type of object in C#. Delegate is very special type of object as earlier the entire the object we used to defined contained data but delegate just contains the details of a method.

Read More

How To Convert Image To The Base64 String

I am going to explain the below two concepts. I will be using jQuery, AJAX, SQL Server, and ASP.NET technologies. How to convert an image to the base64 string and save it to the database. Display image on the webpage from the base64 string. How to convert an image to the base64 string using jQuery? Open Visual Studio X (X=version). Create a new web application. In my case, the name of the application is “SaveImageBase64” as you can see in the below picture (Figure:-1).

Read More

ASP.NET MVC Project Integration With GitHub

In this article, I will explain how to integrate an ASP.NET MVC project with GitHub. Along with that, I will explain some of the below activities often performed by developers on Git. Create Local Branch Push Changes Pull Request Prerequisites to achieve this demo are the following -

Read More

Eight Reasons To Upgrade To VS2017

Have you tried Visual Studio 2017 at home and want to use it at work? Here are eight reasons to upgrade today that you can share with your management.

Read More

Dynamically append data to the grid in ASP.NET with jQuery

Introduction This post is written in support of this forum thread where the author is asking how to append data in the grid that is found from the database based on id.To achieve this, we shall use jQuery for front end and ASP.NET with SQL Server as backend.Use of jQuery First refer the jQuery file under the head element of the page as it is shown below.

Read More

Export SQL Table data to Excel File with Column Headers in asp.net and VB.Net.

In this article I will explain, how to export SQL Table data to Excel file with Column Headers in C#.First of all, we fetch the SQL Server database recodes into DataTable .net Object and then the DataTable will be exported to Excel file using the ClosedXml library in asp.net and VB.Net. DATABASE I have made a SQL table which name is A_RBG_SBG_MASTER. Below i am Show the Design part of the table and its data.

Read More

OOP Concepts in C#

Object oriented programming (OOP) is a programming structure where programs are organized around objects as opposed to action and logic. This is essentially a design philosophy that uses a different set of programming languages such as C#. Understanding OOP concepts can help make decisions about how you should design an application and what language to use....

Read More

What Is Named Arguments In C#

Generally, In Methods call, Arguments are passed according to the order of parameters defined in the method definition. So when making a method call, it is necessary for us to remember the order of parameters before passing the value to the method call. If the number of parameters is large then it is difficult to remember the order.....

Read More

Difference between Abstract and Interface

Abstract class provides a set of rules to implement next class -Rules will be provided through abstract methods -Abstract method does not contain any definition -While inheriting abstract class all abstract methods must be override.....

Read More

Working with Tuple in C# 4.0

The base class library exposes two objects. It exposes the static class Tuple which allows you to get a number of Tuple instances based on the Static method....

Read More

What is ddl hell problem and it’s solution in .net

DLL Hell refers to the set of problems while sharing multiple applications under a single common component like Dynamic Link Library(DLL) or a Component Object Model(COM) class. Simply, it is the problem which occurs while registering the DLL components with a common name. DOT Net has removed this problem by introducing the concept of versioning...

Read More

Subscribe to my weekly newsletter