ng-grid in AngularJS

It’s a common requirement of every project to display data in tabular format(GridView). It’s normal and eaisly way to do by using Asp.Net Gridview or HTML table but it becomes little bit difficult when we need to add some more functionality like sorting (single & multi columns), resizable columns, inline editing, filtering, pagination etc. In […]

Read More

Validation using AngularJS

Form and controls provide validation services, so that the user can be notified of invalid input or data before submitting a form.The AngularJS directive ng-model binds the input elements to the model.ng-show, the spans with color:red are displayed only when content field is $dirty and $invalid. There are some properties of validation in AngularJS $dirty: […]

Read More

jQuery Asynchronous File Upload

In Asp.net ajax, we have Asynchronous fileUpload control for uploading files asynchronously. If you are using JQuery with in your Asp.net app , then using microsoft ajax Asynchronous fileUpload control is not a good practice to upload files asynchronously.In below example I am showing you asynchronous file upload code in Asp.net ajax using jQuery. <html> […]

Read More

Binding dropdown in AngularJS

Here I will explain how to bind dropdownlist value and text using AngularJS or fill dropdowlist with option values using AngularJS. In AngularJS we can fill or bind dropdownlist using ng-repeat or ng-options methods.In below example , Binding city name in dropdown using ng-repeat directive. <html> <head> <title>Binding dropdown in AngularJS</title> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js”></script> <script> var […]

Read More

AngularJS $rootScope and $scope

$scope cannot be used outside the controller whereas $rootScope can be used anywhere, no matter what controller you are in $rootScope is available globally. All other $scopes are children of the $rootScope. Example: <html > <head runat=”server”> <title></title> <script src = “http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js”></script> <script type=”text/javascript”> var app = angular.module(‘myApp’, []); app.controller(‘myCtrl1’, function ($scope, $rootScope) { $scope.num1 […]

Read More

Directives in AngularJS

ng-app directive is used to define AngularJS application. We can use this to auto-bootstrap an AngularJS application. It designates the root element of AngularJS application and generally kept near <body> or <html> tag. We can define any number of ng-app directive inside the HTML document but only one AngularJS application can be bootstrapped automatically (auto-bootstrapped) […]

Read More

File Upload in ASP.NET MVC

Index.cshtml View <html> <head> <title>File Upload Example</title> </head> <body> @using (Html.BeginForm(“Index”, “FileUpload”, FormMethod.Post, new { enctype = “multipart/form-data” })) { <h2>File Upload Example</h2> <label for=”file”>Upload Image:</label> <input type=”file” name=”file” id=”file” /><br><br> <input type=”submit” value=”Upload Image” /> <br><br> @ViewBag.filestatus } </body> </html> HomeController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.IO; namespace […]

Read More

Conditionally apply a class in AngularJS

AngularJS provides a number of built-in directives for manipulating CSS styling dynamically: ng-class – It is use to set or change class name of component dynamically. ng-style – It is use define or modify style of a component dynamically. ng-show and ng-hide – It can be use to show or hide something (modifies CSS) ng-if […]

Read More

Web Grid in ASP.NET MVC

In ASP.NET MVC, the new concept begins WebGrid. WebGrid is lightweight for showing data in tabular format like GridView in Asp.net. Here i will explain how to use WebGrid in asp.net MVC with entity framework. In below HomeController, we used ViewBag  to store user data and use this ViewBag in WebGrid(in View)  to show.  public […]

Read More

Trigger in jQuery

The trigger() method triggers the specified event. It is similar to the triggerHandler() method, except that triggerHandler() does not trigger the default behavior of the event. Trigger events are not limited to browser-based events, you can also trigger custom events registered with bind. Syntax: $(selector).trigger(event,eventObj,param1,param2,…) Example: <html> <head runat=”server”> <title>Trigger example</title> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function […]

Read More

Binding DropDownList from database in Asp.Net MVC

Here I will show how to bind DropDownList from database. There are many ways like with ViewBag dynamic property, model values and database objects. we will follow ViewBag dynamic property.Here create a Dropdown controller then add view with Index name and follow the below code. In below code, we get all record from database using […]

Read More

State management in ASP.NET

State management is the process by which you maintain state and page information over multiple requests for the same or different pages. Why we need of ASP.NET State Management? As we know that Web Applications work on HTTP protocol. HTTP protocol is a stateless protocol, meaning it does not retain state between user requests. Example: […]

Read More

Cookies in Angularjs

In AngularJS, ngCookies module and $cookieStoreservice to carry out the various functions for creating,reading and removing Cookies. The $cookieStore put function has two parameters (name of cookie and value of cookie). The $cookieStore get function accepts the Name of the Cookie in order to read its value. The $cookieStore remove function accepts the Name of […]

Read More

How to get Url Hash (#) from server side

Sometimes we needed to persist the URL hash(#) across ASP.Net postbacks. As the browser does not send the hash to the server by default, the only way it is done by using Javascript or jQuery. When the form submits, grab the hash (window.location.hash) and store it in a server-side hidden field Put this in a […]

Read More