Arelryrourn
New Member
Hello
Am Working on a ASP.Net MVC 3 project and am getting a error called "Resource cannot be found" My situation is i have
1: am Using my own views and returning them in actions for instance i created a view manually first called "Create.cshtml" and manually added it to a action like this
[HttpPost]
Public ActionResult CreateStudent(StudentIfo studentinfo)
{
db.StudentInfo.add(studentinfo);
db.SaveChanges();
Return View("~/Views/Student/Create.cshtml");
}
[HttpGet] Before this Action works good but why Not HttpPost???
My Route Map says:
routes.MapRoute(
" ",
"{controller}/{action}/{id}",
new { controller = "Student", action = "CreateStudent", id = UrlParameter.Optional }
);
2: Whenever i write [HttpPost] i get this Error and if i Remove it then everything works good if such thing continues then how to save the data??
3: My Create.cshtml has a @Html.BeginForm("CreateStudent","Student",FormMethod.Post) am not getting what the issue is?? i have searched alot but not getting a good note.
4: and I wanna ask is what is best way for CURD operation when we are using our own views rather using Visual studios Scaffolding templates i.e am i Going in right way?? i want my own views and then write my contollers according to them not as that of Visual Stuio way first write controller then right click "Add-View"
Please suggest me some good ways or any site or tutorials regarding it
Thanks
Am Working on a ASP.Net MVC 3 project and am getting a error called "Resource cannot be found" My situation is i have
1: am Using my own views and returning them in actions for instance i created a view manually first called "Create.cshtml" and manually added it to a action like this
[HttpPost]
Public ActionResult CreateStudent(StudentIfo studentinfo)
{
db.StudentInfo.add(studentinfo);
db.SaveChanges();
Return View("~/Views/Student/Create.cshtml");
}
[HttpGet] Before this Action works good but why Not HttpPost???
My Route Map says:
routes.MapRoute(
" ",
"{controller}/{action}/{id}",
new { controller = "Student", action = "CreateStudent", id = UrlParameter.Optional }
);
2: Whenever i write [HttpPost] i get this Error and if i Remove it then everything works good if such thing continues then how to save the data??
3: My Create.cshtml has a @Html.BeginForm("CreateStudent","Student",FormMethod.Post) am not getting what the issue is?? i have searched alot but not getting a good note.
4: and I wanna ask is what is best way for CURD operation when we are using our own views rather using Visual studios Scaffolding templates i.e am i Going in right way?? i want my own views and then write my contollers according to them not as that of Visual Stuio way first write controller then right click "Add-View"
Please suggest me some good ways or any site or tutorials regarding it
Thanks