MVC

MVC display image from database

Uploading image to database is not a normal practice but in some situations we need it, in my [previous blog][1] many people request to write to store the image into database, first of all, I would like to thanks for all those emails and interest in my blogs and site. I am going to change the database structure a little bit but use the same modal to post the data from view to controller which... By Ali Adravi   On 03 Aug 2015  Viewed: 16,385
  • mvc
  • image
  • upload

Display Channels and Tags in EPiServer

**Introduction** When creating a website, developers find it challenging to implement a design that works on multiple devices, this included desktops, tablets and mobile devices. EPiServer 7 includes a new feature known as Display Channels. Display Channels allow us to control the rendering of the web pages depending on whether the request is from a mobile device or a standard device. When... By Nikunj Bhanushali   On 26 May 2015  Viewed: 496
  • episerver
  • episerver 7
  • mvc
  • webforms

MVC EnumDropdownListFor bind with enum example

In MVC we have EnumDropDownListFor which we can directly bind with our any enum, it is very similar to DropDownListFor. In this article we will try to create an enum and use it into our model and see how we can bind and save it into the database. As we know we cannot keep space in the name of emum members so how we can use a clear text into dropdown than the enum members. It is easy we will use... By Ali Adravi   On 15 May 2015  Viewed: 9,308
  • mvc
  • enumdropdownlistfor

Exploring what is new in ASP.NET MVC

When we look around in today's world, what we see is devices all around. Devices from mobiles to tablets to computers surround us and now the world is talking about internet of things. IOT means communicating between devices where each device will provide some relevant information to other so as to provide a customer with highest level of service. Example can be a Phone providing information... By Nikunj Bhanushali   On 01 May 2015  Viewed: 521
  • mvc
  • asp.net
  • microsoft technologies

Different action for different buttons from a single page in MVC

To post from different buttons on a single MVC page to different action methods, we need some extra code. We need to create an attribute class by inheriting ActionNameSelectorAttribute and override IsValidName method. We will use the button name to call any particular action on the basis of button name. It looks some thing very difficult but in reality it is more than easy. Let's creat our... By Ali Adravi   On 26 Apr 2015  Viewed: 2,166
  • mvc
  • razor
  • attributes
  • asp.net

MVC DropDownListFor fill on selection change of another dropdown

Binding DropDownListFor from enum, database and some hard coded values in our previous article [MVC dropdown binding best ways][1]. In this article we will try to bind child Dropdown on selection change of parent Dropdown, say Country to State or Sate to City, by using jQuery which will call an action in controller and return JSON for selected id, and with the help of jQuery append values to... By Ali Adravi   On 11 Apr 2015  Viewed: 100,183
  • mvc
  • dropdownlistfor
  • jquery
  • javascript

MVC dropdown binding best ways

To Bind a DropDownListFor or DropDown in asp.net MVC from database, from enum or from hard coded values, most people suggest to add a property in the model with IEnumarable or IList. We can use it but not very helpful because after every postback we will need to fill the list again otherwise it will be null. So using ViewBag is not a bad idea, we will use it in our article. What we will see... By Ali Adravi   On 04 Apr 2015  Viewed: 28,004
  • dropdown
  • dropdownlist
  • dropdownlistfor
  • mvc
  • enum

ASP.Net MVC upload file with record & validation - Step 6

Uploading file with other model data, validate model & file before uploading by using DataAnnotation is a tricky part because there is no FileFor or any similar control in MVC. So very first question comes in mind, is that possible to use DataAnnotation with file control? Yes, it is very possible. Second question, it this possible with client side validation, even the answer is yes. We know... By Ali Adravi   On 28 Mar 2015  Viewed: 8,923
  • mvc
  • file
  • sql
  • model
  • validation

MVC multiple field search with webgrid - Step 5

First of all we will try for multiple field search with paging and sorting for products by using WebGrid. We will create relationship between products and category table so we can show the category name in grid. To search we need a separate model for search having all the paging, sorting, total records and products. We need full featured page to search records by providing product name, price and... By Ali Adravi   On 22 Mar 2015  Viewed: 13,920
  • mvc
  • webgrid
  • dynamic-order
  • paging
  • sorting

MVC CRUD By wizard without writing a single line in 2 minute - Step 4

CRUD functionality is the basic of learning of any language which we will see in this article and we will see how easy it is with asp.net MVC. We already seen, how we created the listing page without writing a single line of HTML. Same we will do for insert, update and delete by using the wizard. We will not write a single line of code but use the wizard to create controller action methods and... By Ali Adravi   On 21 Mar 2015  Viewed: 1,982
  • mvc
  • crud
  • bootstrap

MVC jQuery datepicker enable disable dates

Add, enable, disable dates to datepicker control is really more than easy but I found most beginners struggle with it to add datepicker with a control or to enable and disable dates for a particular condition. In this article we will learn how to add datepicker without any calendar icon as well as with calendar icon. Disable dates which are less than today's date, disable dates which are greater... By Ali Adravi   On 15 Mar 2015  Viewed: 3,500
  • jquery
  • datepicker
  • mvc

Razor conditional attribute and formatting

Razor provides all the option to format the data as well as conditional attributes, even it is more powerful than we had earlier in asp.net. In this article we will try to see some commonly used conditional attribute tricks, formatting of data like apply class conditionally, show hide controls, enable and disable the controls. How to use icons as link in WebGrid, add HTML to the column,... By Ali Adravi   On 14 Mar 2015  Viewed: 6,133
  • razor
  • mvc
  • formatting

MVC Entity Framework Code First - Step 3

In MVC, Entity Framework Code First Model is good fit and easy to use. In this case we don't need to create our model separately. Whatever the model we created in our previous article is enough to create the table for category which we are going to achieve in this article and maney more. We will learn how to use Entity Framework with code first, how to decorate properties of table, property data... By Ali Adravi   On 28 Feb 2015  Viewed: 1,205
  • mvc
  • entity-framework

Learn MVC Step 2 - Model View Controller

In this article we will learn to create model, controller and finally we will add view to render the list of categories by using list template. First we will try to render the list of hard coded values then in next article we will use Empty Framework to save data into database and show data from database. But for now we need to focus how we can create model, controller and view. so add a new... By Ali Adravi   On 24 Feb 2015  Viewed: 792
  • mvc
  • model
  • view
  • controller

Learn MVC Step 1 - Application Structure

Learning asp.net mvc is really easy which we will realize during our articles. We will start from the very beginning to create a hello world application an application using insert, update, delete features and then try to give the option to sell them by using shopping cart at the end of the article. If you already know the asp.net then it's good and if not then it's best, because in MVC, we... By Ali Adravi   On 21 Feb 2015  Viewed: 671
  • mvc

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: 19,929
  • mvc
  • c#
  • image
  • image-gallery
  • 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: 33,568
  • mvc
  • bootstrap
  • modal-popup
  • asp.net

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: 43,381
  • mvc
  • bootstrap
  • webgrid
  • modal-popup
  • asp.net

ng-grid search sort paging with AngularJs WebAPI and MVC ASP.Net

We are going to use ng-grid with feature like searching, sorting and paging of records, we will use paginated data, means pull only as many records as we have to show into our ng-grid. We already discussed about the AngularJS application structure in our previous article see [ASP.Net MVC Web API AngularJS and Bootstrap application structure][3]. We will use Entity Framework and WebAPI to search... By Ali Adravi   On 30 Nov 2014  Viewed: 19,517
  • ng-grid
  • angularjs
  • webapi
  • mvc

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: 7,992
  • angularjs
  • webapi
  • mvc
  • bootstrap
  • asp.net
12