Posts

Server Side Validation In MVC using ModelState

Server Side Validation In MVC using ModelState using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; namespace ServerSideValidationInMVC.Models {     public class Student     {         [Required(ErrorMessage = "Name is Requirde")]         public string Name { get; set; }         [Required(ErrorMessage = "Email is Requirde")]         [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +                             @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +                             @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",                             ErrorMessage = "Email is ...

How to call stored procedure in MVC Application

How to call stored procedure in MVC Application public int UpdateFinalOutcome( bool isDeathCertificate, bool isCornerReferralComplete) { int retVal = 0; SqlCommand dbCommand = new SqlCommand ( "usp_UpsertFinalOutcome" , connection);             try             {                 dbCommand.CommandType = CommandType .StoredProcedure;                 dbCommand.Parameters.AddWithValue( "@isDeathCertificate" , isDeathCertificate);                 dbCommand.Parameters.AddWithValue( "@isCornerReferralComplete" , isCornerReferralComplete); retVal = dbCommand.ExecuteNonQuery(); catch ( Exception ex)      ...

Form Validation

Image
How to validate a form using Jquery Write the below code : < form action ="" id ="frmEnquiry" method ="post" novalidate ="novalidate">                 < p class ="your-para"> Your Name : </ p >                 < input type ="text" name ="Name" id ="Name" value ="" onfocus ="this .value= '' ; " onblur ="if ( this .value == '' ) { this .value = '' ;} ">                 < p class ="your-para"> Your Mail : </ p >                 < input type ="text" name ="Email" id ="Email" value ="" onfocus ="this .value= '' ; " onblur ="if ( this .value == '' ) { this .value = '' ;} ">        ...