Click here to Skip to main content
16,016,744 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
After adding a movie.cs inside models folder and added connection string in web.config file . i tried to access model data from controller but in place of chooosing model class: while creating controller that model class donot shows up?
is there any steps i have to do before creating controller
Posted
Comments
Prasad_Kulkarni 5-Mar-12 6:31am    
Have you given reference of model to controller??
Purushottam Prajapati 5-Mar-12 6:36am    
how to give reference of model to controller?i didn't try that
Purushottam Prajapati 5-Mar-12 6:33am    
After adding a movie.cs inside models folder and added connection string in web.config file . i tried to access model data from controller but in place of chooosing model class: while creating controller that model class donot shows up?
is there any steps i have to do before creating controller
Prasad_Kulkarni 5-Mar-12 6:37am    
i got it from your question prajapati..after adding movies.cs inside models folder and adding connection string in web.config have u given reference of that movies.cs to controller??
Purushottam Prajapati 5-Mar-12 6:39am    
nope

Right click on controller(folder) -> click on Add Reference -> click on project tab -> and select folder in which your movies.cs file is kept.
Try this and tell me whatever the result will be..
 
Share this answer
 
Comments
Purushottam Prajapati 5-Mar-12 6:46am    
there's no add reference tab while right clicking on controller
First add a reference for model in the controller :
ex:
C#
using MVCapplication1.Models;

here MVCapplication1 is the application nameand be sure that the class you want to access is present under Models folder.
then create an instance of the model class, using the instance dot property name can be accessed.
try this
 
Share this answer
 
v3
Comments
Purushottam Prajapati 5-Mar-12 6:52am    
sorry i am very new to this , i am just trying the steps in the tutorials of http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/getting-started-with-mvc3-part5-cs . when i choose " r name: MoviesController. (This is the default. )
Template: Controller with read/write actions and views, using Entity Framework. " i have to choose movie.cs modal class which do not show up? wat can i do ?can u tell me in description
member60 5-Mar-12 7:10am    
Sorry man i am not getting it, if you want to learn the mvc applications then why don't you try some other samples. Adding a controller as shown in this example i am not getting.
member60 5-Mar-12 7:15am    
My suggestion is to proceed with simple examples such as:
http://codesamplez.com/development/introduction-to-asp-net-mvc3-and-razor-in-c-sharp
and
http://weblogs.asp.net/shijuvarghese/archive/2011/01/06/developing-web-apps-using-asp-net-mvc-3-razor-and-ef-code-first-part-1.aspx
Purushottam Prajapati 5-Mar-12 7:16am    
thankx
]

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