MVC model validation for email from database in

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: 6,253
  • mvc

ViewData, ViewBag, TempData and Session in MVC

ViewBag, ViewData, TempData and Session are the options to send value from controller to view or to other action method/pages. ViewData and ViewBag are very straight forward, they used to send the data from controller to view and done but in case of TempData and Session we can pass values from controller to view and even we can get our value from other pages after redirecting. As we know TempData... By Ali Adravi   On 15 Nov 2014  Viewed: 4,862
  • mvc

ASP.Net MVC multiple submit button use in different ways

Multiple submit button in ASP.Net MVC is the common and mostly asked question in interview. In this article we will try to see different ways to use the Multiple submit button in a form and what is the best way to use multiple submit button. What we are going to try: 1. HTML5 FormAction and FormMethod attribute in submit buttons 2. Multiple Submit Buttons With Action Selector Attribute 3.... By Ali Adravi   On 08 Oct 2017  Viewed: 3,965
  • mvc

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: 3,793
  • mvc
  • razor
  • attributes

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 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: 3,740
  • mvc
  • crud
  • bootstrap

ActionResult VS ViewResult in MVC

In MVC controls there are different type of action result we use as a return type from a controller action method in which ViewResult, ActionResult and JsonResult are commonly used. In this article we will learn what are the available action results and which one we need to use in which case. The ActionResult class is the base class for action results, following types derive from... By Ali Adravi   On 19 Jul 2013  Viewed: 3,517
  • actionresult
  • viewresult
  • mvc

Add facebook twitter and google plus in C# MVC application

You need to share your website content with faceboo, twitter and google+ to increase traffic of your website. it's quite easy to implement. You need just a helper class and one line code in your page to call that helper class and done. so let's first write the helper class public static class SocialNetworkingHelper { #region[Twitter helper Method] private... By Ali Adravi   On 13 Jan 2013  Viewed: 3,420
  • mvc
  • c#

How to create a single thanks page for entire controller in MVC

Sometimes we need a thanks page say we have user registration, change password, activate account functionality in our application then we need a thanks page after registering with our site, to say thanks for registering with us or showing confirmation that your password is successfully changed or your account is successfully activated. So do you think we need three different view for these... By Hamden   On 30 Jun 2013  Viewed: 3,282
  • mvc
  • dynamic-view

MVC paging with linq to sql and html helper class

To use paging in MVC you need to first create structure to pass values form page to HTML Helper class so first create a class to keep and pass the page information public class PagingInfo { public int TotalItems { get; set; } public int ItemsPerPage { get; set; } public int CurrentPage { get; set; } public int TotalPages { ... By Ali Adravi   On 03 Jan 2013  Viewed: 3,182
  • mvc
  • linq to sql

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: 2,201
  • 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: 1,550
  • mvc
  • model
  • view
  • controller

Learn MVC Step 1 - Application Structure

Learning 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 then it's good and if not then it's best, because in MVC, we... By Ali Adravi   On 21 Feb 2015  Viewed: 1,383
  • mvc

Action filter basics in ASP.Net MVC

Action filter in MVC is from very first version. Sometimes we want to perform logic before or after calling the action method, to support this MVC provides action filters. Action filters are used as attributes. Filter can be applied on action method or directly to the controller. Suppose we want an action method (say Edit) to be viewed only by authorized users then [Authorize] ... By Hamden   On 13 Jul 2013  Viewed: 1,301
  • action-filter
  • mvc

ASP.Net MVC Entity Framework Entity Validation with DataAnnotation

Validation of Entity with Entity Framework is a tricky way, but it is really simple. In this article we will try to understand how easily we can add the validation with any entity created by Entity Framework with database first approach by using partial classes and pure DataAnnotation. We will not use any if.. else... or switch... case statement to validate different property. It will work with... By Ali Adravi   On 08 Jul 2018  Viewed: 1,200
  • mvc
  • validation

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: 828
  • mvc
  • microsoft technologies

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: 806
  • episerver
  • episerver 7
  • mvc
  • webforms