I want to designing an application Where i need to generate some partial view from user .
My application Students enrollment.
In a partial view user needs to select whether they are new student or Enrolled student using a radio button.
If he is a new student i need to render a form for his enrollment,and if the enrollment is not available at this time,i need to generate a message without showing him the form for enrollment.
if he is a new student i need to show him a different form.
Can anyone suggest what is the best practise to work on this with MVC3 with razor view and c#.
is it a good idea for creating partial views for new and enrolled students.
I’ve had similar situations that I resolved using partial views. What I do is have one ‘top-level’ model, say StudentModel and then I have other ‘inner’ models, such as EnrolledStudentModel etc. I then have a method called GenerateUI() on all models that builds the markup.
The top-level model GenerateUI() simply does something like:
Then in turn UnenrolledStudentModel.GenerateUI() checks if enrollment is open and returns a form otherwise just a div saying enrollment closed, or similar.
That’s the approach I would take. Hope it helps