Razar view Page creation in MVC Step by step (Sign up)
-
Model Creation in Asp.net/MVC
Right click on model folder and than select class the following popup appear where you have to assign any name to the model class
Following is the Signup model class attribute and the concern validations
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace BSCSB.Models
{
public class Mdlsignup
{
[Required]
[Display(Name =”First name”)]
public String Fname { get; set; }
[Required]
[Display(Name = “First name”)]
public String Lname { get; set; }
[Required]
public String Email { get; set; }
[Required]
[StringLength(100, ErrorMessage =”enter atleast 8 character”, MinimumLength =6)]
[DataType(DataType.Password)]
public String Password { get; set; }
[Required]
[StringLength(100, ErrorMessage = “enter atleast 8 character”, MinimumLength = 6)]
[Compare(“Password”, ErrorMessage =”password do not match”)]
[DataType(DataType.Password)]
public String Confirmpassword { get; set; }
[Required]
public String City { get; set; }
[Required]
public String Country { get; set; }
[Required]
[Display(Name = “MObile No”)]
public int Phone { get; set; }
}
}
How to add controller in Asp.net/MVC
Right click on the controller folder select controller > MVC5 empty controller>Add >assigned any name to the controller
Controller method
How to add view in Asp.net/MVC
Right click on controller method name and than select MVC5 View
What we have to select while adding view in asp.net/MVC
view name : your controller method name (you can change also)
Template: select create
Model class: select your model class for this form
Finally the view is created in the concern folder
4 thoughts on “Razar view Page creation in MVC Step by step (Sign up)”
Leave a Reply
You must be logged in to post a comment.
How can we render images in web pages using MVC. HTML tags does not work at All.
For image we use the img tag
in img tag SRC write the below line in double code with proper image path
“@Url.Content(Image path here)”
Is it possible to have a separate, custom CSS for every content page that inherits with master page? if yes then how
Not possible.
if all partial page inherit from the same layout(Master page) then you cant separate the bundling file rendering here to individual partial pages being inherited from same layout.