My Name Is Salman Masood , I am Computer Science &Amp; Maths Graduate from University of Karachi, Pakistan , Teaching Is My Passion and My Aim Is to Deliver All My Knowledge among Those Students Who Can'T Afford Tutors or Expensive Institute Fees. I Will Be Keep Sharing My All Knowledge and Information with You .... Remember Me in Your Prayers !
Monday, 26 November 2018
Data Annotation in ASP NET MVC C# || Code First Approach Entity Framewor...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace WebApplication1.Models
{
[Table("tbl_user")]
public class User
{
[Key]
public int UserId { get; set; }
[Display(Name="Name")]
[Required(ErrorMessage="*")]
[StringLength(50,ErrorMessage="Name should contain Atmost 50 characters")]
[MinLength(3,ErrorMessage="Name should contain Atleast 3 characters")]
[RegularExpression("^[a-z -']+$",ErrorMessage="Invalid Name")]
public string Username { get; set; }
[Display(Name = "Email")]
[Required(ErrorMessage = "*")]
[StringLength(50, ErrorMessage = "Email should contain Atmost 50 characters")]
[MinLength(15, ErrorMessage = "Name should contain Atleast 15 characters")]
[RegularExpression(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$", ErrorMessage = "Invalid Email")]
public string UserEmail { get; set; }
[Display(Name = "Date of Birth")]
[Required(ErrorMessage = "*")]
[DataType(DataType.Date)]
public string Userdob { get; set; }
[Display(Name = "Password")]
[Required(ErrorMessage = "*")]
[StringLength(50, ErrorMessage = "Password should contain Atmost 50 characters")]
[MinLength(6, ErrorMessage = "Password should contain Atleast 6 characters")]
public string userpassword { get; set; }
[Display(Name = "Confrim Password")]
[Required(ErrorMessage = "*")]
[Compare("userpassword",ErrorMessage="Password Does not match...")]
public string usercpassword { get; set; }
}
}
Subscribe to:
Post Comments (Atom)
Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC
Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...
-
Load event: pictureBox3.Image = Image .FromFile( @"C:\Users\salman\Documents\Visual Studio 2013\Projects\WindowsFormsApplication3\W...
No comments:
Post a Comment