following code controller code
using l2.Models;
namespace l2.Controllers
{
public class cl2Controller : Controller
{
//
// GET: /cl2/
public ActionResult Getview()
{
Employee emp = new Employee();
emp.FirstName = "Sukesh";
emp.LastName = "Marla";
emp.Salary = 20000;
ViewData["Employee"] = emp;
return View("MyView");
}
}
}
this is model class code
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Salary { get; set; }
}
this is my view code i.e Myview.cshtml
<div>
@{
l2.Models.Employee emp=(l2.Models.Employee)
ViewData["Employee"];
}
<b>Employee Details </b><br />
Employee Name : @emp.FirstName@emp.LastName <br />
Employee Salary: @emp.Salary.ToString("C")
</div>
here i am not getting any error but while execution time i am getting the following error
The view 'MyView' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/cl2/MyView.aspx
~/Views/cl2/MyView.ascx
~/Views/Shared/MyView.aspx
~/Views/Shared/MyView.ascx
~/Views/cl2/MyView.cshtml
~/Views/cl2/MyView.vbhtml
~/Views/Shared/MyView.cshtml
~/Views/Shared/MyView.vbhtml
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.