ASP.Net

MVC insert update delete and select records

CRUD (Create, Retrieve, Update and Delete) in MVC. When we start to learn new language, first we try to run an application with “Hello World” and then CRUD functionality. So in this article we will see how to select records from database (with WebGrid, pagination and sort functionality), update a record, add new record and finally delete a record in ASP.Net MVC. Let’s create a simple table... By Ali Adravi   On 17 Aug 2013  Viewed: 94,252
  • mvc
  • asp.net
  • sql server

Search, sort, paging, insert, update and delete with ASP.Net MVC and bootstrap modal popup PART-1

Search, sort, paging, insert, update and delete with ASP.Net MVC and bootstrap modal popup and WebGrid to show records with search, sort and paging feature and in next article we will complete our article by adding insert, update and delete feature with bootstrap modal popup. We are going to use Entity Framework 6 code first model with a very simple table phone. Adding client side sorting and... By Ali Adravi   On 28 Dec 2014  Viewed: 52,315
  • mvc
  • bootstrap
  • webgrid
  • modal-popup
  • asp.net

Search, sort, paging, insert, update and delete with ASP.Net MVC and bootstrap modal popup PART-2

To add insert, update and delete feature we are going to use bootstrap modal popup with a single JavaScript method to open any partial view as a modal popup and one method to post the data from modal, which can work for entire application. First we will add some code to our layout view to dynamically add the partial view in it and JavaScript file, then we will add code only one for add new... By Ali Adravi   On 28 Dec 2014  Viewed: 40,778
  • mvc
  • bootstrap
  • modal-popup
  • asp.net

Gridview multiple header rows

How to show multirow header in gridview in asp.net? i was searching for this question but could not found any easy way so I decided to try my own and found it is not so difficult. Simply we can use header template and item template and design it according to our requirements. we will see this in action in this article. First let's see what we are going to do, here is the final output which we... By Ali Adravi   On 30 May 2013  Viewed: 37,233
  • gridview
  • asp.net

Convert object to json and json to object in C#

In this article we will see how to convert an object to json string or how to convert a json string to an object in C#, we will try to write a generic class with two methods, one for converting an object to json and other for converting json string to an object. I searched internet to get if there is anything like this with .net but could not found any which we can use directly, so let's... By Ali Adravi   On 16 Jun 2013  Viewed: 36,524
  • json
  • c#
  • asp.net

Image gallery in asp.net mvc with multiple file and size

Image gallery in asp.net mvc or in any other language can be achieved by using different free JavaScript libraries. What we need for a good image gallery, at least we need images in two sizes to show thumbnail and then the original image on clicking the image. In this article we will write a small method to calculate the new image size and save images in multiple sizes. To upload image we will... By Ali Adravi   On 10 Jan 2015  Viewed: 26,584
  • mvc
  • c#
  • image
  • image-gallery
  • asp.net

Ajax Modalpopupextender show hide from code behind and by javascript

In this article we will discuss different way of show and hide (open and close) modal popup by using Ajax ModalPopupExtender, how to open/close a modal popup from code behind in asp.net or by using JavaScript, how to use multiple buttons to hide the modal popup in asp.net etc. Suppose we have a grid view to show the record in tabular format and give functionality to edit a record from grid... By Jonathan King   On 08 Apr 2013  Viewed: 25,611
  • ajax
  • javascript
  • asp.net

Disable dates in Ajax CalendarExtender

Ajax CalendarExtendar: I found many questions on different sites regarding date range selection in Ajax CalendarExtender, while it is quite simple to bound the range to select from, you can allow all the dates, disable past dates, disable date greater than current date, date should be greater than current date + 1 month, current date to 1 month etc. So let me explain one by one: **For all... By Jonathan King   On 23 Jun 2012  Viewed: 25,050
  • ajax
  • asp.net
  • datepicker
  • jquery

Insert, update and delete in asp.net gridview step by step

We will do insert, update and delete functionality in a GridView with modal popup, we will proceed step by step to learn how easily we can complete this functionality in any project. We will try to create a basic user page where you can see all the users in a grid with paging and buttons to add new user, update an existing user and delete any existing user with confirmation box. We will always... By Hamden   On 01 Sep 2013  Viewed: 20,683
  • asp.net
  • gridview
  • insert
  • update
  • delete

Send email in background thread in C# aps.net

How to send email in a new thread in asp.net by using Gmail account or any other account or you can say a page where we can test out all the settings like SMTP Server, Email From, Email To, Email Password, Port Number, Email DeliveryMethod or Secure Socket etc. In this article we will see how to send email in background thread with CCed and BCCed functionality. Here is the page... By Hamden   On 13 Sep 2013  Viewed: 15,621
  • email
  • asp.net
  • c#

Abstract Class in C# with Example

The purpose of an abstract class is to provide a common definition of base class that multiple derived classes can share, and can be used only as a base class and never want to create the object of this class. Any class can be converted into abstract class by adding abstract modifier to it. Common features of an abstract class: 1. An abstract class cannot be instantiated. 2. An abstract class... By Ali Adravi   On 21 Aug 2013  Viewed: 14,143
  • c#
  • asp.net
  • oops

How to retrieve data from database using JavaScript in asp.net

I was checking how to validate a user email from database without post back, using JavaScript. After some search and RND found the way to call the web service method with the help of Ajax and JavaScript. Let’s say we have a registration page on which we accept email from the user and we expect it should be unique in entire database. So we need a method to immediately validate the email from... By Ali Adravi   On 24 Jun 2012  Viewed: 11,466
  • javascript
  • sql server
  • asp.net

Call code behind method from JavaScript in asp.net

There are ways to call a web service method JavaScript, for more detail you can see [how to retrieve data from database using JavaScript in asp.net][1], but is there any way to call a normal method from JavaScript? And the answer is No; show how we can call a code behind method from JavaScript, let’s see this with code Add following HTML on page: <asp:ScriptManager ID="ScriptManager1"... By Jonathan King   On 08 Apr 2013  Viewed: 10,414
  • asp.net
  • javascript

ASP.Net MVC Web API AngularJS and Bootstrap application structure

Application structure by using ASP.Net MVC, Web API, AngularJs is not complicated but we need to know what NuGet Packages are required and what can make the application easy and speed up the development. In this article we will use MVC 4, Visual Studio 2012, Web API and AngularJS to create a single page application. We will try to use different folders for keeping our controllers, services,... By Ali Adravi   On 17 Nov 2014  Viewed: 9,448
  • angularjs
  • webapi
  • mvc
  • bootstrap
  • asp.net

Nested Gridview binding in asp.net with collapsible feature

ASP.Net GridView binding is really easy but nested binding is a little bit tricky. We need to create two row for every single row one for normal row data and other for nested grid. There are two way to create multiple rows, one is by using the JavaScript by manipulating the html and other is directly from code behind, which we will use in our example, really it is not easy but very easy. We will... By Ali Adravi   On 03 Dec 2014  Viewed: 7,529
  • asp.net
  • gridview
  • c#

ASP.Net MVC file upload

How to upload file or image in asp.net mvc is not difficult but is totally different compare to asp.net FileUpload control. If we are asp.net developer and we are new to mvc then we immediately noticed we don’t have server side controls so the FileUpload control as well and our problem start here. Now we start searching how to upload a file if there is no FileUpload control, no problem whatever... By Ali Adravi   On 25 May 2013  Viewed: 7,073
  • mvc
  • asp.net
  • file-upload

Gridview paginated data with search and sort functionality in asp.net

Most of the times we need to use GridView control to show tabular data in our asp.net application. We simply write procedure to search the records and bind them with GridView and show 10 to 20 records per page. Have you ever thought that why you are fetching all the records and show only 10 to 20 records, why cannot fetch only those records which we have to show on the page, means 20 records if... By Ali Adravi   On 16 Feb 2013  Viewed: 5,948
  • asp.net
  • gridview

MVC model validation for email from database in asp.net

There are many cases where we need to validate the value in controls before submitting to the database, so let's discuss email validation like format, length and existence into database. We will walk through in this article, how to validate entered user email from database, whether email is already exists in database if yes then show error to user that email already taken by some one, if no email... By Ali Adravi   On 05 Jan 2013  Viewed: 5,646
  • mvc
  • asp.net

Ajax AsyncFileUpload control example in asp.net to upload only images

Ajax introduced two new controls AsyncFileUpload and SeaDragon, in this article we will see about Asynchronous file upload control, with its different properties and usage. 1. [AsyncFileUpload][1]: by using this control we can upload a file asynchronously (without postback). The file uploading results can be checked both in the server and client sides. 1. [SeaDrago][2]: The Seadragon... By Ali Adravi   On 20 May 2013  Viewed: 5,538
  • ajax
  • asp.net

Upload multiple image in multiple size with progress bar in asp.net

In asp.net there is not control to select multiple files and upload them once with progress bar, so we will use a small third party DLL to achieve this functionality. We will use Flajaxian FileUploader, you can download it from [http://www.flajaxian.com][1] We will create three different images of size 100X100, 400X400 and original file, you can say thumbnail, medium size image and original... By Hamden   On 12 Jul 2012  Viewed: 5,507
  • asp.net
  • flajaxian
  • image
123