In this short tutorial, I am going to show how to validate a Dropdownlist in MVC3 using Razor Syntax. Our Model Class – using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; namespace DropdownListValidation.Models { public class DropdownListModel { [Required( ErrorMessage = "Selection is a MUST" )] public string SelectedItem { [...]
Most Popular (Last 7 days)
- How to send an Email using C# - complete features
- Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records PART - II
- JQuery POST & GET Request to WCF Service in ASP.Net MVC
- Create a Simple WCF service against Pubs Database using EF, LINQ – Part I
- Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records – Part I
- Create a Simple WCF Service Client against Pubs Database using EF, LINQ – Part II
- Access Code-behind variables in ASPX and JavaScript
- Simple Html Editor based Comments Section with Captcha feature along with Database Interactivity
- ASP.Net MVC–Simple Application Security using Password Hashing before storing it to Database
- Access JavaScript Variables in Code-Behind Class
Most Popular (All time)
- How to send an Email using C# - complete features (29548 views )
- Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records PART - II (18382 views )
- Create a Simple WCF service against Pubs Database using EF, LINQ – Part I (11907 views )
- JQuery POST & GET Request to WCF Service in ASP.Net MVC (11802 views )
- Access Code-behind variables in ASPX and JavaScript (11348 views )
- Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records – Part I (11262 views )
- Create a Simple WCF Service Client against Pubs Database using EF, LINQ – Part II (9232 views )
- Access JavaScript Variables in Code-Behind Class (8631 views )
- Simple Html Editor based Comments Section with Captcha feature along with Database Interactivity (8149 views )
- Data Transfer between two ASP.NET Pages (7873 views )
- Save the World (6710 views )
- Retrieve files from a table in Database using Generic Handler (5646 views )
- Save files to a table in Database using FileUpload control (5522 views )
- ASP.Net MVC–Simple Application Security using Password Hashing before storing it to Database (5326 views )
- How to download files from server to client using a Generic Handler (4340 views )
- AJAX HTML Editor based Contact Form inside UpdatePanel along with UpdateProgress (4263 views )
- JQuery Quickies #1 – GalleryView Plugin by Jack Anderson (3817 views )
- Book Review - MCTS Exam 70-536 Microsoft .NET Framework – Application Development Foundation Self Paced Training Kit - Tony Northrup (3491 views )
- Implementing MVP Pattern using UserControls with WCF Database Operations in Entity Framework and LINQ – PART I (3352 views )
- File Download by Anil (3330 views )
JumpStart Tutorials
- JumpStart # 11 - Xml Comments for code using GhostDoc Extension
- JumpStart # 10 – Display Validation Error Messages in different formats using JavaScript
- JumpStart # 9 – Make Response.Redirect() open in New Blank Window
- JumpStart # 8 – Making Client CallBacks by Implementing ICallBackEventHandler Interface
- JumpStart # 7 – Handling UserControl’s Event from Parent Page
- JumpStart # 6 – Accessing CheckBoxList Control in JavaScript and making a Mandatory Selection Enabled
- JumpStart # 5 – Access Properties of a UserControl from other UserControl in ASP.Net Page
- JumpStart # 4 – validateRequest in ASP.Net
- JumpStart # 3 – ViewStateMode in ASP.Net 4.0
- JumpStart # 2 – OUT Parameter in C#
- JumpStart # 1 - Using Optional And Named Parameters in C#
Latest Entries
Dropdownlist Validation in ASP.Net MVC 3–Razor
RamiVemula on May 12, 2012 at 9:39 pm
Filed under:ARTICLE, ASP.Net MVC, C#
AJAX HTML Editor based Contact Form inside UpdatePanel along with UpdateProgress
RamiVemula on September 7, 2010 at 11:47 pm
In this tutorial, we see how to develop a simple Contact Page webform. This Contact Page is going to be a similar one to what we usually see in our day to day experience out in internet. Here we use AJAX HTML editor to enable Html email to the owner of the website. The basic outline would be – Users provide their general details like name and email, and also they can provide Html Message (using AJAX HTML Editor) in the Contact Page, where a basic validation is done as first step. Then we take the Html string, and send the same in the email to the authorized person of the website (typically owner) using SMTP settings (System.Net.Mail namespace). For ease of use, we use Gmail SMTP settings (host and port) for sending email. For better interactivity UpdateProgress control is used to show the progress of email routine.
JumpStart # 10 – Display Validation Error Messages in different formats using JavaScript
RamiVemula on September 3, 2010 at 1:24 pm
At times, instead of normal display of validation error messages (or even in the validation summary) on the page, we tend to display them in more user friendly manner. This Jumpstart deals with the using JavaScript to get the above shown validation error display formats. The main concentration laid on especially 3 different formats – 1) Water Marking 2) Error Images (beside TextBox) and 3) Alert Dialog. The before mentioned effects can be easily achieved with some quick JavaScript. In this tutorial, we use 3 JavaScript functions to get more flexible user interactivity with the page, they are – validate(), resetValidation(event) and singleValidation(event). In the following code sample we use three simple TextBox and RequiredFieldValidator pairs to demonstrate the validation error effects.






