Saturday, May 28, 2016

Populate dropdownlist using AngularJs in asp.net MVC

In this article I am going to explain how to populate the dropdownlist using AngularJs in asp.net MVC
Populate dropdownlist using AngularJs in asp.net MVC

Description:
I want to populate the dropdown with city.

Implementation:
To fill the dropdownlist foolow the below given steps:

Model Class (tb_City.cs) :
public partial class Tb_City
    {
        public int Id { get; set; }
        public string CityName { get; set; }
        public Nullable<int> StateId_Fk { get; set; }
    }

Add Controller

Thursday, May 26, 2016

AngularJs Error: $injector:nomod Module is not available

I have got an error while working with AngularJs. Error is:
angular.js:4587 Uncaught Error: [$injector:modulerr] Failed to instantiate module mvcapp due to:
Error: [$injector:nomod] Module 'mvcapp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

AngularJs Error $injectornomod Module is not available


This error occurs because I have not defined the module.

Solution:

Wednesday, May 25, 2016

Get data from database and display using AngularJs in asp.net MVC

In this article I am going to explain how to get the data from database using AngularJs in asp.net MVC.

Get data from database and display using AngularJs in asp.net MVC
Click here to Enlarge

Description:
I am using database first approach. I have created a table Tb_City
Id
Int, PK
CityName
varchar(100)

Implementation:

Model (Tb_City.cs):

Saturday, May 21, 2016

Create first application with angularJs in asp.net mvc

In this article I am going to explain how to create a first application with AngularJs in asp.net MVC.
Create first application with angularJs in asp.net mvc


Description:
In this example I am going to show a message, message is “First Application using AngularJs in MVC”.

Implementation:
To create this application follow the given steps:

Create MVC Project
Add new MVC project. I have set up an empty MVC project.

Add Controller
Now add an empty controller (Angular Controller) to project.

Wednesday, May 18, 2016

Introduction of AngularJs

AngularJs is an open source Javascript MVC framework. It is maintain and developed by Google. Google employee Misko Hevery started work on AngularJS in 2009. Its first version 1.0 was released in 2012. It make both development and testing easier. You should have the knowledge of HTML, CSS and JavaScript to use AngularJs in your web project. 1.5.5 is the latest version of AngularJs.

Angular JS is used to build the Single page web application. It extends the HTML DOM (Document Object Model) by adding directive.

Definition of AngularJs of on its website:

“AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.”

How to add AngularJs to web page?

Saturday, May 14, 2016

How to send SMS from asp.net MVC appliction

Tuesday, May 10, 2016

How to send SMS in asp.net using Twilio

Sunday, May 8, 2016

Displays file icons in asp.net

In this article I am going to explain how to display file icons according to file extensions in asp.net


Description:
I have created a table Tb_File and insert some dummy record. I am displaying the record in gridview data control. I want to display filename with file icons according to file type. Let us create a demonstration to implement this concept.

Implementation:

Saturday, May 7, 2016

Asp.net Gridview sorting example using jquery

In this article I am going to explain how to do sorting in gridview data control using Jquery.

Asp.net Gridview sorting example using jquery
In the previous article I have explained how to validate the email address of users in MVC application using Data Annotation, how to filter record in MVC Webgrid based on textbox and how to apply or set the custom style on MVC webgrid.

Description:
We have three ways to implement this functionality: Jquery, Sql datasource and code behind. Here in this tutorial I am going to use Jquery plugin Tablesorter. Go to website of  Tablesorter Jquery plugin and download the latest version.


Implementation:

Create Store procedure to get data

Thursday, May 5, 2016

Open (view) all type of files with associate program in asp.net using C#, VB.net

In this article I am going to explain how to open (view) all type of files (images, word document, excel, PDF etc.) with associate program in asp.net using C#, VB.net.

Open (view) all type of files with associate program in asp.net using C#, VB.net


Description:

Wednesday, May 4, 2016

How to display image icons according to file extensions in asp.net

In this article I am going to explain how to display image icons according to file extensions in asp.net

How to display image icons according to file extensions in asp.net

Description:
I have created a table Tb_File and insert some dummy record. I am displaying the record in gridview data control. I want to display filename with file icons according to file type. Let us create a demonstration to implement this concept.

Implementation:

Tuesday, May 3, 2016

Asp.net Gridview sorting example in ascending and descending order code behind

In this article I am going to explain how to do sorting in gridview data control by column header in ascending and descending order code behind.

Asp.net Gridview sorting example in ascending and descending order code behind

Description:
We have three ways to implement this functionality: Jquery, Sql datasource and code behind. Here in this tutorial I am going to implement using code behind.



Implementation:

Sunday, May 1, 2016

Model validation example to validate email address in MVC

In this article I am going to explain how to validate the email address of users in MVC application using Data Annotation
Model validation example to validate email address in MVC

Description:
We can validate the email address using data annotation regular expression.  Add the below given code before email address property in model (specific class).

[Required(ErrorMessage="Enter Correct Email")]
[DataType(DataType.EmailAddress)]
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}", ErrorMessage = "Invalid email")]

Implement: