Click here to Skip to main content
15,886,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am very new to ASP.NET USING MVC Controllers...so here is my scenario.

Am developing an Online Admission system where students come and fill in their required records to be processed for admission..

i different classes that holds specific information about the student..my student class is

C#
public class Student
    {
        public int ID { get; set; }
        [Required]
        public string NAME { get; set; }
        [Required]
        public string FIRSTNAME { get; set; }
        [Required]
        public string LASTNAME { get; set; }
        public virtual ICollection<Enrollment> Enrollments { get; set; }
    }

i have another class called Enrollments where the user Enters all the courses as well as the Grade
C#
  public class Enrollment
    {
        public int EnrollmentID { get; set; }
        public int CourseID { get; set; }
        public int StudentID { get; set; }
        public Grade Grade { get; set; }
        public virtual Student Student
        {
            get;
            set;
        }
        public virtual Course Course { get; set; }
    }
    public enum Grade
    {
        A,B,C,D,E,F
    }
}

AND different more classes.
I HAVE A CONROLLER called Registration, where i will create the views for each Classes.

SO IN my first View which takes all the student Details,after the Record has been saved.
when the user Clicks next,i want to pass the ID number of the student class to my next view which is the Enrollment View and save the records along with the ID number of the student class which is acting as a foriegn key in the enrollment class and database.

Have been trying so hard 2 implement this but with no success.I would appreciate a simple example to demostrate how to achieve this becos am not too good using the mvc framework as i recently started using ASP.NET..

please i really need help guys..Thanks in advance
Posted
Updated 16-Dec-14 16:21pm
v2

There are some ways to do this - you can use ViewBag, ViewData or TempData.
If you are using MVC4 or higher, use a ViewBag.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900