Skip to main content

Posts

Showing posts with the label ASP.NET MVC

MVC CRUD using AJAX passing model data for POST-PUT-GET-Delete using Entity Framework

//------------------------------------------------------------------------------ // <auto-generated> //     This code was generated from a template. // //     Manual changes to this file may cause unexpected behavior in your application. //     Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ namespace UserManagementWebApp.DataAccess {     using System;     using System.Collections.Generic;         public partial class Customer     {         public int CustId { get; set; }         public string Name { get; set; }         public string Address { get; set; }         public string City { get; set; }         public string State { get; set; }         public string Country { get; set; }         public Nullable<long> Contact { get; set; }         public string Email { get; set; }     } } ----------------------------

MVC DataAnnotations - Validations

using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace MVCWebApp.Models {     public class UserRegistrationModel     {         [Required(ErrorMessage = "Please Enter Name e.g. John Doe")]         [StringLength(30, MinimumLength = 3)]         public string Name { get; set; }         [Required(ErrorMessage = "Please Provide Gender")]         public bool Gender { get; set; }         [Range(18, 60)]         public string Age { get; set; }         [Required]         [DataType(DataType.Date)]         [Display(Name = "Date Of Birth")]         public DateTime? DateOfBirth { get; set; }         [StringLength(200)]         public string Address { get; set; }         [StringLength(35)]         public string City { get; set; }         [Required(ErrorMessage = "Please Enter Mobile No")]         [Display(Name = "Mobile")]         [St

Asp.net MVC Grrid with search add update and delete

CRUD Operations Using jqGrid In ASP.NET MVC 1. Create a new MVC Project and give the name for your project. To create a new MVC  project, Click File > New > Project or press CTRL + SHIFT + N.     2. Select MVC as a project Template with Individual Authentication.     3. Now for creating the table into the database using Code First Approach, I am creating a folder with name "Entities". For creating the folder inside the project right click on the folder and click on Add then click on  New Folder .     Now give the name for the folder as "Entities" .   4.  Add a class inside  Entities  folder with Name "StudentMaster.cs". You can follow the below figure to add class:   Now one dialog box will be open give the name for that class as "StudentMaster.cs".     5. Now write the following code into "StudentMaster". using  System;   using  System.Collections.Generic;   using  System.ComponentModel.D